fix(core): the page flashes when click the share button (#6557)
close TOV-706
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
import type { ServerConfigQuery, ServerFeature } from '@affine/graphql';
|
import type { ServerConfigQuery, ServerFeature } from '@affine/graphql';
|
||||||
import { oauthProvidersQuery, serverConfigQuery } from '@affine/graphql';
|
import {
|
||||||
|
getBaseUrl,
|
||||||
|
oauthProvidersQuery,
|
||||||
|
serverConfigQuery,
|
||||||
|
} from '@affine/graphql';
|
||||||
import type { BareFetcher, Middleware } from 'swr';
|
import type { BareFetcher, Middleware } from 'swr';
|
||||||
|
|
||||||
import { useQueryImmutable } from '../use-query';
|
import { useQueryImmutable } from '../use-query';
|
||||||
@@ -60,9 +64,9 @@ export const useOAuthProviders = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useServerBaseUrl = () => {
|
export const useServerBaseUrl = () => {
|
||||||
const config = useServerConfig();
|
const baseUrl = getBaseUrl();
|
||||||
|
|
||||||
if (!config) {
|
if (!baseUrl) {
|
||||||
if (environment.isDesktop) {
|
if (environment.isDesktop) {
|
||||||
// don't use window.location in electron
|
// don't use window.location in electron
|
||||||
return null;
|
return null;
|
||||||
@@ -71,7 +75,7 @@ export const useServerBaseUrl = () => {
|
|||||||
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
|
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config.baseUrl;
|
return baseUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useCredentialsRequirement = () => {
|
export const useCredentialsRequirement = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user