Skip to content

Commit

Permalink
fix(next): fix useSelectedLayoutSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jun 30, 2024
1 parent 406e697 commit 48fca8e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/react-server-next/src/compat/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
useParams as useParams_,
useRouter as useRouter_,
useSelectedParamEntries,
useSelectedParams,
} from "@hiogawa/react-server/client";
import React from "react";

Expand All @@ -28,8 +27,8 @@ export function useParams<T extends Params = Params>(): T {
}

export function useSelectedLayoutSegments(_todo?: string): string[] {
const selected = useSelectedParams();
return Object.values(selected);
const entries = useSelectedParamEntries();
return React.useMemo(() => entries.map(([_k, v]) => v), [entries]);
}

export function useSelectedLayoutSegment(_todo?: string): string | null {
Expand Down

0 comments on commit 48fca8e

Please sign in to comment.