Skip to content
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: maintenance banner should show right away when toggled #5021

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
Box,
FormControlLabel,
Expand All @@ -10,6 +9,7 @@ import { useMaintenance } from 'hooks/api/getters/useMaintenance/useMaintenance'
import { useMaintenanceApi } from 'hooks/api/actions/useMaintenanceApi/useMaintenanceApi';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import useToast from 'hooks/useToast';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';

const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
Expand All @@ -19,12 +19,12 @@ const StyledContainer = styled('div')(({ theme }) => ({
borderRadius: theme.shape.borderRadiusLarge,
}));

const CardTitleRow = styled(Box)(({ theme }) => ({
const CardTitleRow = styled(Box)({
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
}));
});

const CardDescription = styled(Box)(({ theme }) => ({
color: theme.palette.text.secondary,
Expand All @@ -38,6 +38,7 @@ const SwitchLabel = styled(Typography)(({ theme }) => ({

export const MaintenanceToggle = () => {
const { enabled, refetchMaintenance } = useMaintenance();
const { refetch: refetchUiConfig } = useUiConfig();
const { toggleMaintenance } = useMaintenanceApi();
const { trackEvent } = usePlausibleTracker();
const { setToastData } = useToast();
Expand All @@ -55,6 +56,7 @@ export const MaintenanceToggle = () => {
});
await toggleMaintenance({ enabled: !enabled });
refetchMaintenance();
refetchUiConfig();
};

return (
Expand Down
Loading