Skip to content
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

Merged

Conversation

justinpark
Copy link
Member

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

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@@ -49,16 +50,6 @@ export interface Column {
type: string;
}

export interface Table {
Copy link
Member Author

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
Copy link
Member Author

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

Copy link
Member

@michael-s-molina michael-s-molina left a 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.

superset-frontend/src/SqlLab/reducers/getInitialState.ts Outdated Show resolved Hide resolved
superset-frontend/src/SqlLab/types.ts Outdated Show resolved Hide resolved
superset-frontend/src/SqlLab/types.ts Outdated Show resolved Hide resolved
superset-frontend/src/SqlLab/types.ts Outdated Show resolved Hide resolved
superset-frontend/src/SqlLab/types.ts Outdated Show resolved Hide resolved
superset-frontend/src/hooks/apiResources/sqlLab.ts Outdated Show resolved Hide resolved
superset-frontend/src/hooks/apiResources/sqlLab.ts Outdated Show resolved Hide resolved
superset-frontend/src/hooks/apiResources/sqlLab.ts Outdated Show resolved Hide resolved
superset-frontend/src/hooks/apiResources/sqlLab.ts Outdated Show resolved Hide resolved
},
messageToasts: getToastsFromPyFlashMessages(
(common || {}).flash_messages || [],
(common || {})?.flash_messages || [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(common || {})?.flash_messages || [],
(common || {}).flash_messages || [],

Copy link
Member

@michael-s-molina michael-s-molina left a 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!

@justinpark justinpark merged commit 4d9e9a4 into apache:master Aug 24, 2023
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants