Skip to content

Commit

Permalink
At #394 Fix error when Redux persist store already exists in local st…
Browse files Browse the repository at this point in the history
…orage
  • Loading branch information
kim-jinhyeong committed Mar 21, 2023
1 parent cf38a05 commit c1a59d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
14 changes: 8 additions & 6 deletions frontend/src/clouds/containers/Clouds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Clouds extends PureComponent<Props, State> {
handleClearTimeout,
router,
} = this.props
const {timeRange, autoRefreshOptions} = this.state
const {timeRange, autoRefreshOptions, currentRoute} = this.state

return (
<Page className="hosts-list-page">
Expand All @@ -144,11 +144,13 @@ class Clouds extends PureComponent<Props, State> {
customAutoRefreshOptions={autoRefreshOptions}
customAutoRefreshSelected={cloudAutoRefresh}
/>
<TimeRangeDropdown
//@ts-ignore
onChooseTimeRange={this.handleChooseTimeRange}
selected={timeRange}
/>
{currentRoute !== 'openstack' && (
<TimeRangeDropdown
//@ts-ignore
onChooseTimeRange={this.handleChooseTimeRange}
selected={timeRange}
/>
)}
<Button
icon={IconFont.ExpandA}
onClick={this.handleClickPresentationButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ class AutoRefreshDropdown extends Component<Props, State> {
customAutoRefreshOptions,
customAutoRefreshSelected,
} = this.props
const checkSelected = customAutoRefreshOptions
? customAutoRefreshSelected?.[customAutoRefreshOptions[0].group] === 0
: selected === 0
return checkSelected

if (customAutoRefreshOptions) {
const groupName = customAutoRefreshOptions[0].group
const customRefreshTime =
customAutoRefreshSelected?.[groupName] === undefined
? 0
: customAutoRefreshSelected?.[groupName]

return customRefreshTime === 0
}

return selected === 0
}

private get className(): string {
Expand Down Expand Up @@ -114,7 +122,7 @@ class AutoRefreshDropdown extends Component<Props, State> {
option =>
option.milliseconds ===
(customAutoRefreshSelected?.[option.group] ||
customAutoRefreshSelected.default)
customAutoRefreshSelected?.default)
)
return selectedOption?.id || 'auto-refresh-paused'
}
Expand Down

0 comments on commit c1a59d6

Please sign in to comment.