mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 18:55:57 +08:00
feat(core): add useQueryImmutable (#5299)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { getIsOwnerQuery } from '@affine/graphql';
|
||||
import { useQuery } from '@affine/workspace/affine/gql';
|
||||
import { useQueryImmutable } from '@affine/workspace/affine/gql';
|
||||
|
||||
export function useIsWorkspaceOwner(workspaceId: string) {
|
||||
const { data } = useQuery({
|
||||
const { data } = useQueryImmutable({
|
||||
query: getIsOwnerQuery,
|
||||
variables: {
|
||||
workspaceId,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { serverConfigQuery } from '@affine/graphql';
|
||||
import { useQuery } from '@affine/workspace/affine/gql';
|
||||
import { useQueryImmutable } from '@affine/workspace/affine/gql';
|
||||
import type { BareFetcher, Middleware } from 'swr';
|
||||
|
||||
const wrappedFetcher = (fetcher: BareFetcher<any> | null, ...args: any[]) =>
|
||||
@@ -10,13 +10,10 @@ const errorHandler: Middleware = useSWRNext => (key, fetcher, config) => {
|
||||
};
|
||||
|
||||
export const useServerFlavor = () => {
|
||||
const { data: config, error } = useQuery(
|
||||
const { data: config, error } = useQueryImmutable(
|
||||
{ query: serverConfigQuery },
|
||||
{
|
||||
use: [errorHandler],
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnMount: false,
|
||||
revalidateIfStale: false,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user