Skip to content

Commit

Permalink
fix: refetch permissions in case reload document
Browse files Browse the repository at this point in the history
  • Loading branch information
cptrodgers committed Jul 23, 2024
1 parent b1c8250 commit 38bcb80
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/ikigai/hook/UseLoadDocument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export const useLoadDocument = (documentId: string) => {

const role = useAuthUserStore((state) => state.role);
const activeDocument = useDocumentStore((state) => state.activeDocument);
const fetchDocumentPermissions = useAuthUserStore(
(state) => state.fetchDocumentPermissions,
);
const fetchSpacePermissions = useAuthUserStore(
(state) => state.fetchSpacePermissions,
);
const setActiveDocument = useDocumentStore(
(state) => state.setActiveDocument,
);
Expand Down Expand Up @@ -101,6 +107,7 @@ export const useLoadDocument = (documentId: string) => {

const load = async () => {
setLoading(true);
await fetchDocumentPermissions(documentId);
const { data, error } = await fetchDocument({
variables: {
documentId,
Expand Down Expand Up @@ -186,6 +193,7 @@ export const useLoadDocument = (documentId: string) => {
};

const fetchSpaceInformation = async (spaceId: number) => {
await fetchSpacePermissions(spaceId);
const { data } = await fetchSpaceDocuments({
variables: {
spaceId,
Expand Down

0 comments on commit 38bcb80

Please sign in to comment.