mirror of
https://github.com/penpot/penpot.git
synced 2026-11-17 07:30:35 +00:00
* 🐛 Carry the team id in every team scoped navigation The eleven `go-to-*` helpers of `app.main.data.common` resolved the team with a plain `or` against `:current-team-id`, or read that key alone, so an event emitted while no team was initialized built a dashboard or workspace route without a `team-id`. `team-container*` raises `:not-found :invalid-team-id` for such a route and `exception-section*` does not report `:not-found`, so the user landed on the not-found page and PostHog never saw it. Add `resolve-team-id`, which falls back to the team of the route already on screen and then to the profile `:default-team-id`. The route goes first on purpose: an emitter that runs from a team screen knows which team the user is looking at, and the personal team would open their file under another team. The `:default` sentinel keeps its meaning. With none of the four the helper still navigates with a nil id, which is the documented last resort. Harden the team-container test at the same time: it now renders the same component with the store team the caller wants, captures markup and errors per render, unmounts the root from a `finally`, and covers the guard that compares the route id with the store team. React reports a hook-order violation through `console.error` and recovers, and only when a render adds hooks, so the harness captures that too and the "id leaves" direction stays a guard test. Closes #12962 AI-assisted-by: deepseek-v4.1-flash * ♻️ Measure the navigation tests by termination The `emitted` helper of `common_test` waited for the first event, with a budget of 50 macrotasks, so a helper that emitted anything before its navigation could be disposed early, and a helper that stopped closing its stream passed on the first event. Wait for termination instead: `async/observe` over a subject, and make `go-to-dashboard-search` complete by pushing the `::rt/navigated` it listens for, which is the event it waits for in the app to focus the search box. Every helper of the family is measured the same way now, `-search` included. `nav-params` returns nil when no navigation matched instead of calling `deref` on nil, as its docstring promised. Add the mirror test for the `:default` sentinel of `go-to-dashboard-deleted`, the second copy of the branch that `-recent` already had covered. Correct two memories: the resolver decides for every team scoped helper, not for every `go-to-*` and not alone, since two direct `rt/nav` emitters are the residual; and `(rx/empty)` is for a stream that must not emit, not for one that must stay open. Relates to #12962 AI-assisted-by: deepseek-v4.1-flash