Skip to content

Commit

Permalink
Remove update to dev button on ErrorBoundary for stable server
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan committed Nov 1, 2023
1 parent 8a479e2 commit 2829ffc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux';
import { useNavigate, useRouteError } from 'react-router-dom';

import Button from '@/components/Input/Button';
import { useGetInitVersionQuery } from '@/core/rtkQuery/splitV3Api/initApi';
import { usePostWebuiUpdateMutation } from '@/core/rtkQuery/splitV3Api/webuiApi';
import { unsetDetails } from '@/core/slices/apiSession';

Expand All @@ -11,6 +12,7 @@ const ErrorBoundary = () => {
const navigate = useNavigate();
const error = useRouteError() as Error; // There is no type definition provided.

const version = useGetInitVersionQuery();
const [webuiUpdateTrigger, webuiUpdateResult] = usePostWebuiUpdateMutation();

const [updateChannel, setUpdateChannel] = useState<'Stable' | 'Dev'>('Stable');
Expand Down Expand Up @@ -68,14 +70,16 @@ const ErrorBoundary = () => {
Force update to Stable Web UI
</Button>

<Button
onClick={() => handleWebUiUpdate('Dev')}
className="px-4 py-2 drop-shadow-md"
buttonType="primary"
loading={updateChannel === 'Dev' && webuiUpdateResult.isLoading}
>
Force update to Dev Web UI
</Button>
{version.data?.Server.ReleaseChannel !== 'Stable' && (
<Button
onClick={() => handleWebUiUpdate('Dev')}
className="px-4 py-2 drop-shadow-md"
buttonType="primary"
loading={updateChannel === 'Dev' && webuiUpdateResult.isLoading}
>
Force update to Dev Web UI
</Button>
)}

<Button
onClick={() => handleLogout()}
Expand Down

0 comments on commit 2829ffc

Please sign in to comment.