-
Notifications
You must be signed in to change notification settings - Fork 690
Fix widget goals tests. #6170
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
base: master
Are you sure you want to change the base?
Fix widget goals tests. #6170
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,14 +68,16 @@ export function GenericGoal() { | |
| }; | ||
| } | ||
|
|
||
| // Note: the loading state `w.state.isLoading` must be checked directly for reactivity. `w.hasLoadedSettings` is only called | ||
| // once and on component load will always show the loading state as false | ||
| return ( | ||
| <WidgetLayout> | ||
| <Menu onClick={e => w.setSelectedTab(e.key)} selectedKeys={[w.selectedTab]}> | ||
| <Menu.Item key="general">{$t('Visual Settings')}</Menu.Item> | ||
| {!isCharity && <Menu.Item key="goal">{$t('Goal Settings')}</Menu.Item>} | ||
| </Menu> | ||
| <Form> | ||
| {w.hasLoadedSettings() && w.selectedTab === 'goal' && !hasGoal && ( | ||
| {!w.state.isLoading && w.hasLoadedSettings() && w.selectedTab === 'goal' && !hasGoal && ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed this is happening, though it's not an issue in the actual prod flow since it's already loaded. I don't think that we can't both get reactivity and TypeScript predicates to play nice, since the way it works would require mutating the object to use Let's just remove Should just need to:
|
||
| <> | ||
| <FormFactory | ||
| metadata={w.createGoalMeta} | ||
|
|
@@ -91,10 +93,10 @@ export function GenericGoal() { | |
| </Button> | ||
| </> | ||
| )} | ||
| {w.hasLoadedSettings() && w.selectedTab === 'goal' && hasGoal && ( | ||
| {!w.state.isLoading && w.hasLoadedSettings() && w.selectedTab === 'goal' && hasGoal && ( | ||
| <DisplayGoal goal={w.goalSettings} resetGoal={w.resetGoal} /> | ||
| )} | ||
| {w.hasLoadedSettings() && w.selectedTab === 'general' && ( | ||
| {!w.state.isLoading && w.hasLoadedSettings() && w.selectedTab === 'general' && ( | ||
| <FormFactory | ||
| metadata={w.visualMeta} | ||
| values={w.settings} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.