🐛(frontend) fix circular dependency problems

A circular dependency was introduced in the previous
commit.
This commit resolves the circular dependency by
refactoring the code to remove the circular reference.
This commit is contained in:
Anthony LC
2025-10-13 11:21:18 +02:00
parent fa7cf7a594
commit 127c90ca5f
10 changed files with 21 additions and 10 deletions

View File

@@ -2,7 +2,9 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc, KEY_LIST_DOC } from '..';
import { Doc } from '../types';
import { KEY_LIST_DOC } from './useDocs';
export type CreateChildDocParam = Pick<Doc, 'title'> & {
parentId: string;

View File

@@ -1,7 +1,8 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc } from '@/docs/doc-management';
import { Doc } from '../types';
export type CreateFavoriteDocParams = Pick<Doc, 'id'>;

View File

@@ -1,7 +1,8 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc } from '@/docs/doc-management';
import { Doc } from '../types';
export type DeleteFavoriteDocParams = Pick<Doc, 'id'>;

View File

@@ -5,7 +5,8 @@ import {
} from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc } from '@/docs/doc-management';
import { Doc } from '../types';
import { KEY_CAN_EDIT } from './useDocCanEdit';

View File

@@ -3,9 +3,12 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { useTranslation } from 'react-i18next';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc, KEY_DOC } from '@/docs/doc-management';
import { useBroadcastStore } from '@/stores';
import { Doc } from '../types';
import { KEY_DOC } from './useDoc';
export type UpdateDocLinkParams = Pick<Doc, 'id' | 'link_reach'> &
Partial<Pick<Doc, 'link_role'>>;

View File

@@ -8,12 +8,12 @@ import {
KEY_LIST_DOC,
Role,
} from '@/docs/doc-management';
import { KEY_LIST_DOC_ACCESSES } from '@/docs/doc-share';
import { User } from '@/features/auth';
import { useBroadcastStore } from '@/stores';
import { OptionType } from '../types';
import { KEY_LIST_DOC_ACCESSES } from './useDocAccesses';
import { KEY_LIST_USER } from './useUsers';
interface CreateDocAccessParams {

View File

@@ -2,9 +2,10 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Doc, Role } from '@/docs/doc-management';
import { Invitation, OptionType } from '@/docs/doc-share/types';
import { User } from '@/features/auth';
import { Invitation, OptionType } from '../types';
import { KEY_LIST_DOC_INVITATIONS } from './useDocInvitations';
interface CreateDocInvitationParams {

View File

@@ -6,10 +6,10 @@ import {
import { APIError, errorCauses, fetchAPI } from '@/api';
import { KEY_DOC, KEY_LIST_DOC } from '@/docs/doc-management';
import { KEY_LIST_USER } from '@/docs/doc-share';
import { useBroadcastStore } from '@/stores';
import { KEY_LIST_DOC_ACCESSES } from './useDocAccesses';
import { KEY_LIST_USER } from './useUsers';
interface DeleteDocAccessProps {
docId: string;

View File

@@ -7,7 +7,8 @@ import {
fetchAPI,
useAPIInfiniteQuery,
} from '@/api';
import { Invitation } from '@/docs/doc-share/types';
import { Invitation } from '../types';
export type DocInvitationsParams = {
docId: string;

View File

@@ -6,7 +6,8 @@ import {
import { APIError, errorCauses, fetchAPI } from '@/api';
import { Role } from '@/docs/doc-management';
import { Invitation } from '@/docs/doc-share/types';
import { Invitation } from '../types';
import { KEY_LIST_DOC_INVITATIONS } from './useDocInvitations';