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): Remove validation result from state #24082

Conversation

justinpark
Copy link
Member

SUMMARY

Similar to #23488 and #23257, this commit migrates the queryValidations state from redux to rdk-query to reduce the complexity of the queryEditor state.

This commit not only reduces the state structure but also reuses the pre-validate result.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After:
Screenshot 2023-05-16 at 11 19 38 AM

after--validation-state-refactor.mov

Before:

Screenshot_2023-05-16_at_11_22_46_AM
before--validation-state-refactor.mov

TESTING INSTRUCTIONS

Go to sqllab and type invalid sql in the editor
check the validation errors

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

@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Merging #24082 (0762251) into master (9df8d8d) will increase coverage by 0.06%.
The diff coverage is 93.64%.

❗ Current head 0762251 differs from pull request most recent head 0048a83. Consider uploading reports for the commit 0048a83 to get more accurate results

@@            Coverage Diff             @@
##           master   #24082      +/-   ##
==========================================
+ Coverage   68.30%   68.37%   +0.06%     
==========================================
  Files        1957     1959       +2     
  Lines       75594    75606      +12     
  Branches     8224     8231       +7     
==========================================
+ Hits        51637    51692      +55     
+ Misses      21849    21801      -48     
- Partials     2108     2113       +5     
Flag Coverage Δ
javascript 54.82% <66.66%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...set-ui-core/src/ui-overrides/ExtensionsRegistry.ts 100.00% <ø> (ø)
...hart-echarts/src/BigNumber/BigNumberTotal/index.ts 66.66% <ø> (ø)
...arts/src/BigNumber/BigNumberWithTrendline/index.ts 66.66% <ø> (ø)
...s/plugin-chart-pivot-table/src/PivotTableChart.tsx 0.00% <0.00%> (ø)
...t-frontend/plugins/plugin-chart-table/src/index.ts 66.66% <ø> (ø)
superset-frontend/src/SqlLab/actions/sqlLab.js 69.43% <ø> (+2.77%) ⬆️
superset-frontend/src/SqlLab/reducers/sqlLab.js 41.17% <ø> (+2.71%) ⬆️
superset-frontend/src/SqlLab/types.ts 57.14% <ø> (ø)
...nd/src/components/ErrorMessage/BasicErrorAlert.tsx 93.75% <ø> (ø)
superset-frontend/src/components/Table/index.tsx 75.29% <ø> (ø)
... and 229 more

... and 24 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@justinpark justinpark force-pushed the chore--sqllab-remove-query-validation-from-state branch from 4591b72 to 8961780 Compare May 23, 2023 18:18
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 the changes @justinpark. I left some first-pass comments.

},
],
};
const expectDbId = 'db1';
Copy link
Member

Choose a reason for hiding this comment

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

Nice code organization!

},
{ overwriteRoutes: true },
);
const { result, waitFor } = renderHook(
Copy link
Member

Choose a reason for hiding this comment

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

This piece of code is identical to previous tests. Can you extract a function called initialize that accepts an optional withValidator? Something like:

const initialize = (withValidator?: boolean) => {...};

// First test
const { result } = initialize() 

// Second and third tests
const { result } = initialize(true) 

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@justinpark justinpark force-pushed the chore--sqllab-remove-query-validation-from-state branch from 8961780 to 0048a83 Compare June 7, 2023 23:04
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

@justinpark justinpark merged commit c4242a3 into apache:master Jun 8, 2023
john-bodley pushed a commit to john-bodley/superset that referenced this pull request Jun 18, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 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/XL 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants