Skip to content

chore(site): migrate a few services to react-query used in the DashboardProvider #9667

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

Merged
merged 21 commits into from
Sep 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve verbiage
  • Loading branch information
BrunoQuaresma committed Sep 11, 2023
commit fc932a6a11a8fce2ef32b8f08304d3adc8c83e1c
13 changes: 5 additions & 8 deletions site/src/components/Dashboard/DashboardProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@ export const DashboardProviderContext = createContext<
>(undefined);

export const DashboardProvider: FC<PropsWithChildren> = ({ children }) => {
const buildInfoQuery = useBuildInfo();
const entitlementsQuery = useEntitlements();
const buildInfo = useBuildInfo();
const entitlements = useEntitlements();
const [appearanceState, appearanceSend] = useMachine(appearanceMachine);
const [experimentsState] = useMachine(experimentsMachine);
const { appearance, preview } = appearanceState.context;
const { experiments } = experimentsState.context;
const isLoading =
!buildInfoQuery.data ||
!entitlementsQuery.data ||
!appearance ||
!experiments;
!buildInfo.data || !entitlements.data || !appearance || !experiments;

const setAppearancePreview = (config: AppearanceConfig) => {
appearanceSend({
Expand All @@ -64,8 +61,8 @@ export const DashboardProvider: FC<PropsWithChildren> = ({ children }) => {
return (
<DashboardProviderContext.Provider
value={{
buildInfo: buildInfoQuery.data,
entitlements: entitlementsQuery.data,
buildInfo: buildInfo.data,
entitlements: entitlements.data,
experiments,
appearance: {
preview,
Expand Down