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

fix(sqllab): remove set state on component update lifecycle #21771

Merged
merged 4 commits into from
Oct 24, 2022

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Oct 11, 2022

SUMMARY

Since the legacy TabbedSqlEditor component uses UNSAFE_componentWillReceiveProps lifecycle method to update the state for editorQueries and dataPreviewQueries, which only consumes in the result panel.
This can also violate the maximum update depth exceeded in some point.

This commit deprecates UNSAFE_componentWillReceiveProps implementation and moves to the SouthPane connector where it actually needs.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
Screen Shot 2022-10-11 at 11 00 46 AM

Screen Shot 2022-10-10 at 4 34 19 PM

After:
No errors

TESTING INSTRUCTIONS

  • Turn off SQLLAB_BACKEND_PERSISTENCE
  • Go to SqlLab and open a tab
  • Modify the localState of redux.sqlLab.tables (remove the table data associated to the current queryEditor id) from the array) in order to trigger the following setState update during lifecycle period.

if (
!areArraysShallowEqual(dataPreviewQueries, this.state.dataPreviewQueries)
) {
this.setState({ dataPreviewQueries });

  • Refresh the page and check the console

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
    cc: @ktmud

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

LGTM

@ktmud
Copy link
Member

ktmud commented Oct 11, 2022

Can you add more details on how to reproduce this max-depth-call-stack error?

@codecov
Copy link

codecov bot commented Oct 11, 2022

Codecov Report

Merging #21771 (52d33b0) into master (d7ee443) will increase coverage by 0.04%.
The diff coverage is 50.96%.

❗ Current head 52d33b0 differs from pull request most recent head 1442a5d. Consider uploading reports for the commit 1442a5d to get more accurate results

@@            Coverage Diff             @@
##           master   #21771      +/-   ##
==========================================
+ Coverage   66.85%   66.89%   +0.04%     
==========================================
  Files        1800     1805       +5     
  Lines       68967    69064      +97     
  Branches     7339     7369      +30     
==========================================
+ Hits        46107    46203      +96     
+ Misses      20968    20953      -15     
- Partials     1892     1908      +16     
Flag Coverage Δ
hive 52.92% <31.25%> (-0.01%) ⬇️
javascript 53.27% <49.15%> (+0.09%) ⬆️
mysql 78.35% <59.37%> (+0.09%) ⬆️
postgres 78.41% <59.37%> (+0.10%) ⬆️
presto 52.82% <31.25%> (-0.01%) ⬇️
python 81.47% <59.37%> (+0.01%) ⬆️
sqlite 76.90% <59.37%> (+0.09%) ⬆️
unit 51.06% <21.87%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
...d/packages/superset-ui-chart-controls/src/index.ts 100.00% <ø> (ø)
...t-controls/src/sections/echartsTimeSeriesQuery.tsx 33.33% <0.00%> (ø)
...perset-ui-chart-controls/src/sections/sections.tsx 87.50% <0.00%> (ø)
...chart-controls/src/shared-controls/dndControls.tsx 58.33% <0.00%> (ø)
...et-ui-chart-controls/src/shared-controls/index.tsx 53.44% <0.00%> (-0.79%) ⬇️
...t-ui-chart-controls/src/shared-controls/mixins.tsx 33.33% <0.00%> (ø)
...ntend/packages/superset-ui-core/src/color/index.ts 100.00% <ø> (ø)
...ackages/superset-ui-core/src/query/types/Column.ts 100.00% <ø> (ø)
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <ø> (ø)
.../BigNumber/BigNumberWithTrendline/controlPanel.tsx 16.66% <0.00%> (ø)
... and 93 more

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

justinpark added a commit to airbnb/superset-fork that referenced this pull request Oct 11, 2022
@justinpark
Copy link
Member Author

Can you add more details on how to reproduce this max-depth-call-stack error?

@ktmud I updated the step to reproduce

@EugeneTorap
Copy link
Contributor

LGTM! Can we merge it?

@ktmud ktmud merged commit 792820e into apache:master Oct 24, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants