-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: [M3-7334] - Improve, clean up, and simplify app entrypoint and render tree logic #9844
refactor: [M3-7334] - Improve, clean up, and simplify app entrypoint and render tree logic #9844
Conversation
export const defaultState: State = { | ||
expiration: null, | ||
loggedInAsCustomer: false, | ||
scopes: null, | ||
token: null, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to default to null
when we can synchronously know the default values form local storage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically AuthenticationWrapper
converted into a hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enzyme test isn't providing much value anymore. Many of the test cases are no longer accurate and we have plenty of e2e coverage that checks that the app loads properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome cleanup 🎉 . Adds a lot of clarity to our entry point. I think it's pretty close, I have not noticed any issue while testing locally but left some comments to see about improving a few things
desktop_sidebar_open: !preferences?.desktop_sidebar_open, | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this much cleaner approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same 🧹
const { | ||
expire: expiryInLocalStorage, | ||
scopes: scopesInLocalStorage, | ||
token: tokenInLocalStorage, | ||
} = authentication; | ||
|
||
const defaultToken = tokenInLocalStorage.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this const
declared here to avoid typing out tokenInLocalStorage.get()
in line 25 and 27?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the feedback.
This looks ready as far as I could test it. ✅
Have not found issues locally and we probably want to have this sit in develop sooner than later so we can catch any potential issue before the next release.
|
className={cx(classes.content, { | ||
[classes.fullWidthContent]: | ||
desktopMenuIsOpen || | ||
(desktopMenuIsOpen && desktopMenuIsOpen === true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm this line looks a little odd, good job cleaning it up
} = props; | ||
const { desktopMenuToggle, isSideMenuOpen, openSideMenu, username } = props; | ||
|
||
const { loggedInAsCustomer } = useAuthentication(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good cleanup
desktop_sidebar_open: !preferences?.desktop_sidebar_open, | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same 🧹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
import 'src/exceptionReporting'; | ||
import Logout from 'src/layouts/Logout'; | ||
import { setupInterceptors } from 'src/request'; | ||
import { storeFactory } from 'src/store'; | ||
|
||
import { App } from './App'; | ||
import { LinodeThemeWrapper } from './LinodeThemeWrapper'; | ||
import NullComponent from './components/NullComponent'; | ||
import { loadDevTools, shouldEnableDevTools } from './dev-tools/load'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a small thing:
Should we dynamically import dev tools to ensure they arent part of the production bundle?
Description 📝
The goal of this PR is to simplify the entry point logic of Cloud Manager. Currently, the flow of
index.tsx ➡️ AuthenticationWrapper.tsx ➡️ App.tsx ➡️ MainContent.tsx ➡️ ...
is very complex and hard to follow, this ticket should help a little bit. There is a lot to clean up and improvement potential, but this PR is a solid startChanges 🔄
Preview 📷
Note
No UI changes are expected
How to test 🧪
Verification steps
As an Author I have considered 🤔