Skip to content

Commit

Permalink
fix: nextjs __PRIVATE_NEXTJS_INTERNALS_TREE 누락 문제를 해결하고, 버전업으로 인한 wik…
Browse files Browse the repository at this point in the history
…i 런타임 에러를 해결합니다 (#46)

* fix: nextjs __PRIVATE_NEXTJS_INTERNALS_TREE 누락 문제 (#45)

* fix: Add safeguard for undefined __PRIVATE_NEXTJS_INTERNALS_TREE in history state (Safari bugfix)

* chore: nextjs version

* fix: useSearchParams use client

* chore: 불필요한 use client 삭제 (#47)

* fix: Add safeguard for undefined __PRIVATE_NEXTJS_INTERNALS_TREE in history state (Safari bugfix)

* chore: nextjs version

* fix: useSearchParams use client

* wiki 코드 개선

* chore: 불필요한 use client 삭제

---------

Co-authored-by: Chung-il Jung <[email protected]>

---------

Co-authored-by: Chung-il <[email protected]>
  • Loading branch information
minsoo-web and tooooo1 authored Sep 16, 2024
1 parent 86aeb49 commit 5918611
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 84 deletions.
2 changes: 1 addition & 1 deletion apps/home/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion apps/home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@next/mdx": "^14.2.5",
"dayjs": "^1.11.11",
"framer-motion": "^11.2.4",
"next": "^14.1.1",
"next": "^14.2.11",
"next-mdx-remote": "^5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
11 changes: 0 additions & 11 deletions apps/wiki/app/_shared/components/Docs/Docs.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/wiki/app/_shared/components/Docs/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/wiki/app/_shared/components/Readme/index.tsx

This file was deleted.

7 changes: 2 additions & 5 deletions apps/wiki/app/_shared/components/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import type { NAV_ITEMS } from '@/_shared/constants'
import { cn } from '@hamsurang/ui'
import Link from 'next/link'
import { useSearchParams } from 'next/navigation'

export interface SideNavProps {
items: typeof NAV_ITEMS
docsId: string | null
}

export const SideNav = ({ items }: SideNavProps) => {
const { get } = useSearchParams()
const docsId = get('id')

export const SideNav = ({ docsId, items }: SideNavProps) => {
return (
<nav className="p-4 w-[296px] mobile:w-full">
<section className="shadow-sm border rounded-lg">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MDXStylingComponents, cn } from '@hamsurang/ui'
import { MDXRemote } from 'next-mdx-remote/rsc'

export const Readme = ({ text, className }: { text: string; className?: string }) => (
export const WikiMDX = ({ text, className }: { text: string; className?: string }) => (
<div className={cn('border-slate-200 border-2 rounded-lg p-[24px]', className)}>
<MDXRemote source={text} components={MDXStylingComponents} />
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/wiki/app/_shared/components/WikiMDX/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './WikiMDX'
3 changes: 1 addition & 2 deletions apps/wiki/app/_shared/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { SideNav } from './SideNav'
export * from './Readme'
export * from './Docs'
export * from './WikiMDX'
3 changes: 2 additions & 1 deletion apps/wiki/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const inter = Inter({ subsets: ['latin'] })
export default function RootLayout({ children }: PropsWithChildren): JSX.Element {
const router = useRouter()
const searchParams = useSearchParams()
const docId = searchParams.get('id')

useEffect(() => {
const handleIncomingMessage = ({ origin, data }: MessageEvent) => {
Expand Down Expand Up @@ -48,7 +49,7 @@ export default function RootLayout({ children }: PropsWithChildren): JSX.Element
<main className="flex gap-6 mobile:flex-col px-4 max-w-[1200px] mx-auto pt-iframe-padding">
<Suspense>
{children}
<SideNav items={NAV_ITEMS} />
<SideNav items={NAV_ITEMS} docsId={docId} />
</Suspense>
</main>
</body>
Expand Down
14 changes: 11 additions & 3 deletions apps/wiki/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { DEFAULT_NAV_ITEM_ID, Docs } from '@/_shared'
import { DEFAULT_NAV_ITEM_ID, WikiMDX } from '@/_shared'
import './reset.css'

export default function Page({ searchParams }: { searchParams: Record<'id', string> }) {
return <Docs id={searchParams.id || DEFAULT_NAV_ITEM_ID} />
const WIKI_URI = 'https://raw.githubusercontent.com/wiki/hamsurang/origin'
const ENCODED_DASH = '%E2%80%90'

export default async function Page({ searchParams }: { searchParams: Record<'id', string> }) {
const id = searchParams.id || DEFAULT_NAV_ITEM_ID

const res = await fetch(`${WIKI_URI}/${id.replace(/-/g, ENCODED_DASH)}.md`)
const wiki = await res.text()

return <WikiMDX className="border-none pt-0 w-[896px] mobile:w-full" text={wiki} />
}
2 changes: 1 addition & 1 deletion apps/wiki/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion apps/wiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/mdx": "^14.2.5",
"next": "^14.1.1",
"next": "^14.2.11",
"next-mdx-remote": "^5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
115 changes: 62 additions & 53 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@hamsurang/icon": "workspace:*",
"@hamsurang/utils": "workspace:*",
"@hamsurang/constants": "workspace:*",
"next": "^14.1.1",
"next": "^14.2.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"framer-motion": "^11.2.4",
Expand Down

0 comments on commit 5918611

Please sign in to comment.