Doceditor: add loggs for API timers
This commit is contained in:
parent
05f4471567
commit
5d572b1236
@ -37,7 +37,9 @@ export default async function RootLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const startDate = new Date();
|
||||
const [user, settings] = await Promise.all([getUser(), getSettings()]);
|
||||
const timer = new Date().getTime() - startDate.getTime();
|
||||
|
||||
if (settings === "access-restricted") redirect(`${getBaseUrl()}/${settings}`);
|
||||
|
||||
@ -58,7 +60,11 @@ export default async function RootLayout({
|
||||
</head>
|
||||
<body>
|
||||
<StyledComponentsRegistry>
|
||||
<Providers contextData={{ user, settings }} api_host={api_host}>
|
||||
<Providers
|
||||
contextData={{ user, settings }}
|
||||
api_host={api_host}
|
||||
timer={timer}
|
||||
>
|
||||
{children}
|
||||
</Providers>
|
||||
</StyledComponentsRegistry>
|
||||
|
@ -57,6 +57,8 @@ async function Page({ searchParams }: RootPageProps) {
|
||||
const { fileId, fileid, version, doc, action, share, editorType } =
|
||||
searchParams ?? initialSearchParams;
|
||||
|
||||
const startDate = new Date();
|
||||
|
||||
const data = await getData(
|
||||
fileId ?? fileid ?? "",
|
||||
version,
|
||||
@ -66,7 +68,9 @@ async function Page({ searchParams }: RootPageProps) {
|
||||
editorType,
|
||||
);
|
||||
|
||||
return <Root {...data} />;
|
||||
const timer = new Date().getTime() - startDate.getTime();
|
||||
|
||||
return <Root {...data} timer={timer} />;
|
||||
}
|
||||
|
||||
export default Page;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import ErrorContainer from "@docspace/shared/components/error-container/ErrorContainer";
|
||||
@ -62,6 +62,7 @@ const Root = ({
|
||||
doc,
|
||||
fileId,
|
||||
hash,
|
||||
timer,
|
||||
}: TResponse) => {
|
||||
const documentserverUrl = config?.editorUrl ?? error?.editorUrl;
|
||||
const fileInfo = config?.file;
|
||||
@ -75,6 +76,10 @@ const Root = ({
|
||||
|
||||
const { t } = useTranslation(["Editor", "Common"]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("editor timer: ", timer);
|
||||
}, [timer]);
|
||||
|
||||
useRootInit({
|
||||
documentType: config?.documentType,
|
||||
});
|
||||
|
@ -45,12 +45,14 @@ const TranslationProvider = ({
|
||||
settings,
|
||||
user,
|
||||
api_host,
|
||||
timer,
|
||||
}: TTranslationProvider) => {
|
||||
const { i18n } = useI18N({ settings, user });
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log("API_HOST: ", api_host);
|
||||
}, [api_host]);
|
||||
console.log("LAYOUT API timer:", timer);
|
||||
}, [api_host, timer]);
|
||||
|
||||
return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
|
||||
};
|
||||
|
@ -42,9 +42,9 @@ export type TProviders = {
|
||||
contextData: TContextData;
|
||||
};
|
||||
|
||||
const Providers = ({ children, contextData, api_host }: TProviders) => {
|
||||
const Providers = ({ children, contextData, api_host, timer }: TProviders) => {
|
||||
return (
|
||||
<TranslationProvider {...contextData} api_host={api_host}>
|
||||
<TranslationProvider {...contextData} api_host={api_host} timer={timer}>
|
||||
<ThemeProvider {...contextData}>
|
||||
<ErrorProvider {...contextData}>
|
||||
{children}
|
||||
|
Loading…
Reference in New Issue
Block a user