Skip to content

Back-to-project links from side pages drop the active entity selection #227

Description

@damienriehl

Problem

useProjectHomeHref (lib/hooks/useProjectHomeHref.ts) routes side-page back-buttons to either /projects/{id} or /projects/{id}/editor based on the preferEditMode preference, but it does not carry the active class/property/individual selection through.

Used by:

  • app/projects/[id]/analytics/page.tsx
  • app/projects/[id]/pull-requests/page.tsx
  • app/projects/[id]/settings/page.tsx
  • app/projects/[id]/suggestions/page.tsx
  • app/projects/[id]/suggestions/review/page.tsx

The viewer↔editor switcher (ViewerEditorSwitcher) carries selection correctly because it reads useSelectionStore and falls back to URL params. But the side-page back links call useProjectHomeHref directly, which builds a bare URL.

Why it matters

A user who is editing class :Foo, opens settings, then clicks "Back to project" lands on the project root with no selection — they have to navigate back to the entity manually. This was one of the motivating frustrations behind issue #98.

Proposed fix

Have useProjectHomeHref read the same selection store + URL fallback used by ViewerEditorSwitcher, and append the appropriate ?<type>Iri=… key.

Or: make useProjectHomeHref not return a bare string — return a hook-friendly object that callers can pass through <Link>-style helpers, with selection plumbed automatically.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions