-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: re-reduce router change re-render
Signed-off-by: Innei <tukon479@gmail.com>
- Loading branch information
Showing
4 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import type { PropsWithChildren } from 'react' | ||
|
||
import { NoteLeftSidebar } from '~/components/widgets/note/NoteLeftSidebar' | ||
import { NoteIdProvider } from '~/providers/note/note-id-provider' | ||
import { NoteLayoutRightSideProvider } from '~/providers/note/right-side-provider' | ||
import { clsxm } from '~/utils/helper' | ||
|
||
export default async (props: PropsWithChildren) => { | ||
return ( | ||
<div | ||
className={clsxm( | ||
'relative mx-auto grid min-h-screen max-w-[50rem]', | ||
'gap-4 md:grid-cols-1 lg:max-w-[calc(50rem+400px)] lg:grid-cols-[1fr_minmax(auto,50rem)_1fr]', | ||
'mt-24', | ||
)} | ||
> | ||
<NoteLeftSidebar className="relative hidden lg:block" /> | ||
<NoteIdProvider> | ||
<div | ||
className={clsxm( | ||
'relative mx-auto grid min-h-screen max-w-[50rem]', | ||
'gap-4 md:grid-cols-1 lg:max-w-[calc(50rem+400px)] lg:grid-cols-[1fr_minmax(auto,50rem)_1fr]', | ||
'mt-24', | ||
)} | ||
> | ||
<NoteLeftSidebar className="relative hidden lg:block" /> | ||
|
||
<div className="relative md:col-start-1 lg:col-auto"> | ||
{props.children} | ||
</div> | ||
<div className="relative md:col-start-1 lg:col-auto"> | ||
{props.children} | ||
</div> | ||
|
||
<NoteLayoutRightSideProvider className="relative hidden lg:block" /> | ||
</div> | ||
<NoteLayoutRightSideProvider className="relative hidden lg:block" /> | ||
</div> | ||
</NoteIdProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client' | ||
|
||
import { createContextState } from 'foxact/context-state' | ||
|
||
export const [NoteIdProvider, useNoteId, useSetNoteId] = createContextState< | ||
undefined | string | ||
>(undefined) |
f0f529f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
springtide – ./
springtide-git-main-innei.vercel.app
springtide.vercel.app
springtide-innei.vercel.app