fuma-nama / fumadocs

The beautiful docs framework with Next.js. Alternative to Nextra
https://fumadocs.vercel.app
MIT License
1.89k stars 115 forks source link

Root selector does not update on group #1092

Closed mishushakov closed 1 day ago

mishushakov commented 1 day ago

To Reproduce

I'm using the following structure:

Screenshot 2024-11-22 at 15 00 43

I have (test) root and section root repo: https://github.com/mishushakov/fuma-docs-repro

Current vs. Expected behavior

The selector does not update when you switch roots if a root is group

Screenshot 2024-11-22 at 15 00 19 Screenshot 2024-11-22 at 15 00 25

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.21
  pnpm: 9.12.2
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: 15.0.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

UI

Additional context

No response

fuma-nama commented 1 day ago

Thanks for the reproduction. I found the problem, the tabs component accepts only url prop for items, which isn't enough to detect the correct group from pathname.

It's because group members will conflict with the other pages outside the group. (e.g. /dir/(group)/page.md and /dir/another.md yields urls with the same directory dir), and it now requires also the page tree to make it work.

Going to make a fix tomorrow

mishushakov commented 1 day ago

Thank you so much!!

fuma-nama commented 1 day ago

Currently the check relies on object references, it should be working but welcome to reopen if the fix has problems