-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(assistantState): cache full state when reloading assistant (#39)
- Add examples dependency to submit handler (last state loaded) - Center data-load spinner and wrap both UIs Co-authored-by: giancarlo tricerri <giancarlo@datadriven.works>
- Loading branch information
Showing
3 changed files
with
43 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
explore-assistant-extension/src/pages/ExploreBasePage/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
Layout, | ||
Spinner, | ||
Space, | ||
SpaceVertical | ||
} from '@looker/components' | ||
import React, { useEffect } from 'react' | ||
import { useSelector } from 'react-redux' | ||
import { RootState } from '../../store' | ||
|
||
const ExploreBasePage = ({ children }: { children: React.ReactNode }) => { | ||
const [loading, setLoading] = React.useState<boolean>(true) | ||
const { examples } = | ||
useSelector((state: RootState) => state.assistant) | ||
|
||
|
||
useEffect(() => { | ||
if ( | ||
examples.exploreGenerationExamples.length > 0 && | ||
examples.exploreRefinementExamples.length > 0 | ||
) { | ||
setLoading(false) | ||
} | ||
}, [examples]) | ||
|
||
return ( | ||
<Layout height={'100%'} hasAside={true}> | ||
{loading ? ( | ||
<Space><SpaceVertical align={'center'} ><Spinner color="key" /></SpaceVertical></Space> | ||
) : (children)} | ||
</Layout> | ||
) | ||
} | ||
|
||
export default ExploreBasePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters