Skip to content

Commit 7b87437

Browse files
committed
condition loading PadData to being auth
1 parent 8fe8d74 commit 7b87437

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function App() {
3535
selectTab,
3636
updateSharingPolicy,
3737
leaveSharedPad
38-
} = usePadTabs();
38+
} = usePadTabs(isAuthenticated);
3939

4040
const [showSettingsModal, setShowSettingsModal] = useState(false);
4141
const [excalidrawAPI, excalidrawRefCallback] = useCallbackRefState<ExcalidrawImperativeAPI>();

src/frontend/src/hooks/usePadTabs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,14 @@ const createNewPad = async (): Promise<Tab> => {
119119
};
120120
};
121121

122-
export const usePadTabs = () => {
122+
export const usePadTabs = (isAuthenticated?: boolean) => {
123123
const queryClient = useQueryClient();
124124
const [selectedTabId, setSelectedTabId] = useState<string>('');
125125

126126
const { data, isLoading, error, isError } = useQuery<PadResponse, Error>({
127127
queryKey: ['padTabs'],
128128
queryFn: fetchUserPads,
129+
enabled: isAuthenticated === true,
129130
});
130131

131132
// Effect to manage tab selection based on data changes and selectedTabId validity

0 commit comments

Comments
 (0)