Skip to content

Commit

Permalink
remove: blocknote text color btn & fix: offline access causes a doubl…
Browse files Browse the repository at this point in the history
…e GET me (#353)
  • Loading branch information
LemonardoD authored Jan 23, 2025
1 parent 69d2ffc commit 556f59f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/modules/common/blocknote/blocknote-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const customFormattingToolBarConfig: CustomFormatToolBarConfig = {
blockTypeSelect: false,
blockStyleSelect: true,
blockAlignSelect: false,
textColorSelect: true,
textColorSelect: false,
blockNestingSelect: false,
fileCaption: true,
replaceFile: true,
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { meQueryOptions, menuQueryOptions } from '~/modules/users/query';
import { queriesToMap } from '~/offline-config';
import { prefetchQuery, waitFor } from '~/query/helpers';
import { useGeneralStore } from '~/store/general';
import { useUserStore } from '~/store/user';
import type { UserMenuItem } from '~/types/common';

const queryMutationFileImports = import.meta.glob('~/modules/**/query-mutations.ts');
Expand All @@ -19,9 +20,10 @@ const GC_TIME = 24 * 60 * 60 * 1000; // 24 hours

export const QueryClientProvider = ({ children }: { children: React.ReactNode }) => {
const { offlineAccess } = useGeneralStore();

const { user } = useUserStore();
useEffect(() => {
if (!offlineAccess) return;
// Exit early if offline access is disabled or no stored user is available
if (!offlineAccess || !user) return;

(async () => {
await waitFor(1000); // wait for a second to avoid server overload
Expand Down Expand Up @@ -53,7 +55,7 @@ export const QueryClientProvider = ({ children }: { children: React.ReactNode })
await prefetchMenuItems(section as UserMenuItem[]);
}
})();
}, [offlineAccess]);
}, [offlineAccess, user]);

if (!offlineAccess) return <BaseQueryClientProvider client={queryClient}>{children}</BaseQueryClientProvider>;

Expand Down

0 comments on commit 556f59f

Please sign in to comment.