-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
chore(sqllab): typescript for getInitialState #25047
chore(sqllab): typescript for getInitialState #25047
Conversation
@@ -49,16 +50,6 @@ export interface Column { | |||
type: string; | |||
} | |||
|
|||
export interface Table { |
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.
migrate to SqlLab/types
) { | ||
const { sqlLab } = JSON.parse(localStorage.getItem('redux')); | ||
const localStorageData = localStorage.getItem('redux'); | ||
const sqlLabCacheData = localStorageData |
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.
Stores the parsed object here to save the additional JSON.parse operation at line 147
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.
Thank you for PR @justinpark. I left some first-pass comments.
}, | ||
messageToasts: getToastsFromPyFlashMessages( | ||
(common || {}).flash_messages || [], | ||
(common || {})?.flash_messages || [], |
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.
(common || {})?.flash_messages || [], | |
(common || {}).flash_messages || [], |
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. Thank you for addressing the comments @justinpark!
SUMMARY
Part 2 of SQLLab SPA migration: detail link
This commit migrates the existing getInialState helper to typescript to be compatible with SPA entrypoint with
/api/v1/sqllab/
. (This commit also adjusts the existing SqlLab types and dependent types)This commit also introduces
useSqlLabInitialStateQuery
which fetches/api/v1/sqllab/
and will be used with the updated getInitialState helper in the next page component integration.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
npm run type
npm run test
ADDITIONAL INFORMATION