Compare commits

...

1 Commits

Author SHA1 Message Date
Henit Chobisa
fa521f3997 fix: fixed page triggering unnessasary mutate function 2023-12-15 11:28:06 +05:30
2 changed files with 11 additions and 14 deletions

View File

@@ -106,10 +106,10 @@ const DocumentReadOnlyEditor = ({
archivedAt={pageArchiveConfig && pageArchiveConfig.archived_at}
/>
<div className="flex h-full w-full overflow-y-auto">
<div className="sticky top-0 h-full w-56 flex-shrink-0 lg:w-80">
<div className="sticky top-0 h-full w-56 flex-shrink-0 lg:w-72">
<SummarySideBar editor={editor} markings={markings} sidePeekVisible={sidePeekVisible} />
</div>
<div className="h-full w-full">
<div className="h-full w-[calc(100%-14rem)] lg:w-[calc(100%-18rem-18rem)]">
<PageRenderer
updatePageTitle={() => Promise.resolve()}
readonly={true}
@@ -118,7 +118,7 @@ const DocumentReadOnlyEditor = ({
documentDetails={documentDetails}
/>
</div>
<div className="hidden w-56 flex-shrink-0 lg:block lg:w-80" />
<div className="hidden w-56 flex-shrink-0 lg:block lg:w-72" />
</div>
</div>
);

View File

@@ -82,7 +82,7 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
description_html: newDescription,
})
.then(() => {
mutatePageDetails((prevData) => ({ ...prevData, description_html: newDescription }) as IPage, false);
mutatePageDetails((prevData) => ({ ...prevData, description_html: newDescription } as IPage), false);
});
};
@@ -162,15 +162,12 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
}, [pageDetails?.description_html]); // TODO: Verify the exhaustive-deps warning
function createObjectFromArray(keys: string[], options: any): any {
return keys.reduce(
(obj, key) => {
if (options[key] !== undefined) {
obj[key] = options[key];
}
return obj;
},
{} as { [key: string]: any }
);
return keys.reduce((obj, key) => {
if (options[key] !== undefined) {
obj[key] = options[key];
}
return obj;
}, {} as { [key: string]: any });
}
const mutatePageDetailsHelper = (
@@ -180,7 +177,7 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
onErrorAction: () => void
) => {
const commonSwrOptions: MutatorOptions = {
revalidate: true,
revalidate: false,
populateCache: false,
rollbackOnError: () => {
onErrorAction();