Skip to content

Commit

Permalink
fix: fix useSelectedLayoutSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jun 28, 2024
1 parent eaaf866 commit 2b8d9a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/react-server-next/src/compat/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
routerRevalidate,
useParams as useParams_,
useRouter as useRouter_,
useSelectedParamEntries,
useSelectedParams,
} from "@hiogawa/react-server/client";
import React from "react";
Expand Down Expand Up @@ -32,8 +33,8 @@ export function useSelectedLayoutSegments(_todo?: string): string[] {
}

export function useSelectedLayoutSegment(_todo?: string): string | null {
// TODO: probably useSelectedParamEntries()[0]
return useSelectedLayoutSegments()[0] ?? null;
const [next] = useSelectedParamEntries();
return next?.[1] ?? null;
}

export function useRouter() {
Expand Down

0 comments on commit 2b8d9a5

Please sign in to comment.