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(CustomFrame): Resolves issue #21731 where date range in explore throws runtime error #21776

Merged
merged 2 commits into from
Oct 13, 2022

Conversation

eric-briscoe
Copy link
Contributor

SUMMARY

Resolves issue #21731 where date range in explore throws runtime error when explore.common is undefined in Redux state.
See associated issue: #21731

This issue is reproducible from the 2.0.0 and 2.0.1 RC1 releases but the change also improves runtime resilience of master. PR is targeting master, but intended to be cherry picked into the 2.0.1 RC1 as well.

Changes made in superset/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx

in PR https://github.com/apache/superset/pull/20063/files#diff-ac08ce133d14a8a92607bf02bc368b6b52b8314ddef1b872e42746ba8d6038d0

introduced a bug that expects redux state to contain a path that may be undefined, and assume that a provided locale is valid and known by antd. This fix ensures safety checks are made and that antd DatePicker can fall back to internal default is a compatible locale is not identified.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

See associated issue: #21731

TESTING INSTRUCTIONS

See associated issue: #21731

ADDITIONAL INFORMATION

…e error when explore.common is undefined in Redux state

Changes made in superset/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx in PR https://github.com/apache/superset/pull/20063/files#diff-ac08ce133d14a8a92607bf02bc368b6b52b8314ddef1b872e42746ba8d6038d0

introduced bug that expects redux state to contain a path that is undefined

// case when common.locale is populated with invalid locale
const mockInvalidStore = configureStore([thunk]);
const invalidStore = mockInvalidStore({ common: { locale: 'invalid_locale' } });
Copy link
Member

Choose a reason for hiding this comment

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

I'm not familiar with the return object of configureStore but can you create two separate distinct stores with the same return of configureStore? In other words, can we create empty and invalid both from the mockEmptyStore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch! I was able to consolidate one call to configureStore, and reuse calls to mockStore with the different values.

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

just left one question/possible nit about duplication of the test store.

@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #21776 (1fb3f67) into master (bd3166b) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #21776      +/-   ##
==========================================
- Coverage   66.88%   66.86%   -0.02%     
==========================================
  Files        1802     1803       +1     
  Lines       68987    68997      +10     
  Branches     7345     7349       +4     
==========================================
- Hits        46139    46134       -5     
- Misses      20951    20971      +20     
+ Partials     1897     1892       -5     
Flag Coverage Δ
javascript 53.20% <100.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
...trols/DateFilterControl/components/CustomFrame.tsx 75.00% <100.00%> (+4.03%) ⬆️
...ontrols/DateFilterControl/utils/dateFilterUtils.ts 39.39% <0.00%> (-60.61%) ⬇️
...nts/controls/DateFilterControl/DateFilterLabel.tsx 35.71% <0.00%> (-5.70%) ⬇️
...ontrols/DndColumnSelectControl/DndFilterSelect.tsx 44.03% <0.00%> (-1.01%) ⬇️
...et-ui-chart-controls/src/shared-controls/index.tsx 53.44% <0.00%> (-0.79%) ⬇️
superset-frontend/src/explore/constants.ts 100.00% <0.00%> (ø)
...et-frontend/src/explore/reducers/exploreReducer.js 37.50% <0.00%> (ø)
...ntend/plugins/plugin-chart-table/src/buildQuery.ts 56.25% <0.00%> (ø)
...nd/packages/superset-ui-core/src/query/getXAxis.ts 100.00% <0.00%> (ø)
...nd/plugins/plugin-chart-table/src/controlPanel.tsx 53.12% <0.00%> (ø)
... and 28 more

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

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

thanks for the fix and add new test case!

@eschutho eschutho merged commit 2258fbf into apache:master Oct 13, 2022
Fahrenheit35 pushed a commit to Fahrenheit35/superset that referenced this pull request Nov 11, 2022
AAfghahi pushed a commit that referenced this pull request Nov 21, 2022
AAfghahi pushed a commit that referenced this pull request Dec 15, 2022
@mistercrunch mistercrunch added 🍒 2.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 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/M v2.0 v2.0.1 🍒 2.0.1 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants