-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
fix(CustomFrame): Resolves issue #21731 where date range in explore throws runtime error #21776
Conversation
…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' } }); |
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.
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
?
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.
Great catch! I was able to consolidate one call to configureStore, and reuse calls to mockStore with the different values.
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.
just left one question/possible nit about duplication of the test store.
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
thanks for the fix and add new test case!
…lore throws runtime error (apache#21776)
…hrows runtime error (#21776)
…hrows runtime error (#21776)
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