Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): the page flashes when click the share button (#6557)

JimmFlycbba5d3c176d
diff --git a/packages/frontend/core/src/hooks/affine/use-server-config.ts b/packages/frontend/core/src/hooks/affine/use-server-config.ts
index 6203b2756e..1418894145 100644
--- a/packages/frontend/core/src/hooks/affine/use-server-config.ts
+++ b/packages/frontend/core/src/hooks/affine/use-server-config.ts
@@ -1,5 +1,9 @@
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 { useQueryImmutable } from '../use-query';
@@ -60,9 +64,9 @@ export const useOAuthProviders = () => {
};
export const useServerBaseUrl = () => {
- const config = useServerConfig();
+ const baseUrl = getBaseUrl();
- if (!config) {
+ if (!baseUrl) {
if (environment.isDesktop) {
// don't use window.location in electron
return null;
@@ -71,7 +75,7 @@ export const useServerBaseUrl = () => {
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
}
- return config.baseUrl;
+ return baseUrl;
};
export const useCredentialsRequirement = () => {