Skip to content

Commit

Permalink
Invalidate only remote backend queries when user go online
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFlashAccount committed Dec 27, 2024
1 parent 0c41e8d commit d8e38b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/gui/src/dashboard/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export default function App(props: AppProps) {
const { mutate: executeBackgroundUpdate } = useMutation({
mutationKey: ['refetch-queries', { isOffline }],
scope: { id: 'refetch-queries' },
mutationFn: () => queryClient.refetchQueries({ type: 'all' }),
mutationFn: () => queryClient.refetchQueries({ type: 'all', queryKey: [RemoteBackend.type] }),
networkMode: 'online',
onError: () => {
toastify.toast.error(getText('refetchQueriesError'), {
Expand Down
3 changes: 2 additions & 1 deletion app/gui/src/dashboard/services/LocalBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export function extractTypeAndId<Id extends backend.AssetId>(id: Id): AssetTypeA
* This is used instead of the cloud backend API when managing local projects from the dashboard.
*/
export default class LocalBackend extends Backend {
readonly type = backend.BackendType.local
static readonly type = backend.BackendType.local
readonly type = LocalBackend.type
/** All files that have been uploaded to the Project Manager. */
uploadedFiles: Map<string, backend.UploadedLargeAsset> = new Map()
private readonly projectManager: ProjectManager
Expand Down
4 changes: 3 additions & 1 deletion app/gui/src/dashboard/services/RemoteBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ interface RemoteBackendPostOptions {

/** Class for sending requests to the Cloud backend API endpoints. */
export default class RemoteBackend extends Backend {
readonly type = backend.BackendType.remote
static readonly type = backend.BackendType.remote

readonly type = RemoteBackend.type
private user: object.Mutable<backend.User> | null = null

/**
Expand Down

0 comments on commit d8e38b7

Please sign in to comment.