Skip to content

JITSU-125 Show recent workspaces inline in the workspace switcher#1421

Merged
vklimontovich merged 1 commit into
newjitsufrom
vladimir/jitsu-125-show-workspaces-inline-in-the-workspace-switcher-dropdown
Jul 23, 2026
Merged

JITSU-125 Show recent workspaces inline in the workspace switcher#1421
vklimontovich merged 1 commit into
newjitsufrom
vladimir/jitsu-125-show-workspaces-inline-in-the-workspace-switcher-dropdown

Conversation

@vklimontovich

Copy link
Copy Markdown
Contributor

What

Switching workspaces took an extra hop: the switcher dropdown only linked to the /workspaces page. This lists the user's most-recently-used workspaces inline in the dropdown, so the common case is one click.

JITSU-125

Changes

Client — WorkspacePageLayout.tsx (WorkspaceSelector / WorkspacesMenu)

  • Renders up to 10 workspaces inline above the existing "All Workspaces" / "Create new" links, current one marked with a check; each links to /{slug|id}.
  • Selected by last-used, displayed alphabetically — the set is your most relevant workspaces, but the on-screen order is stable (case-insensitive), so it never reshuffles under you when recency changes.
  • Preloaded on mount (not on first click), so the dropdown paints instantly.
  • Refreshed in the background on workspace switch via queryClient.invalidateQueries — the dropdown is closed at switch time, so set-membership updates off-screen with no flicker.
  • More (N) link to /workspaces when there are more than shown.

Server — pages/api/workspace/index.ts

  • GET /api/workspace now orders by the current user's last-used time at the DB level (raw-SQL LEFT JOIN on WorkspaceUserProperties, ORDER BY lastUsed DESC NULLS LAST), so ?page=0&limit=N returns the true N most-recent. Previously the DB page was ordered by createdAt and only re-sorted in memory, so ?limit=10 returned the 10 oldest-created.
  • No query-param or response-shape change; recency ordering is now the default for all callers (a strict improvement). Never-opened workspaces still appear, sorted last.

Testing

  • pnpm codegen + tsc --noEmit clean.
  • Ran the console locally against a real DB: switcher lists workspaces, click routes into a workspace, order is stable alphabetically, "More" appears past 10.

JITSU-125

Switcher now lists the 10 most-recently-used workspaces (selected by
last-used server-side, rendered alphabetically for a stable order),
preloaded on mount and refreshed in the background on switch. A "More"
link covers the rest.

GET /api/workspace now orders by the current user's last-used time at the
DB level via a raw-SQL LEFT JOIN, so ?limit=N returns the real N most
recent instead of an oldest-created page re-sorted in memory.

@jitsu-code-review jitsu-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the two modified files (WorkspacePageLayout.tsx and pages/api/workspace/index.ts) with a focus on correctness, security, and user-visible regressions.

I verified the recent-workspace dropdown wiring, pagination/ordering behavior, and the new raw SQL query construction for parameter safety and access scoping. I did not find actionable bugs or security issues in this changeset.

@vklimontovich vklimontovich added the deploy:console Auto-deploy console to beta when this PR merges (JITSU-68) label Jul 23, 2026
@vklimontovich
vklimontovich merged commit 2f9fc14 into newjitsu Jul 23, 2026
5 checks passed
@vklimontovich
vklimontovich deleted the vladimir/jitsu-125-show-workspaces-inline-in-the-workspace-switcher-dropdown branch July 23, 2026 14:23
@github-actions

Copy link
Copy Markdown
Contributor

🚀 deploy:console label detected — triggered a beta console deployment to jitsu-cloud-infra. Track it in the deploy runs (newest at top): https://github.com/jitsucom/jitsu-cloud-infra/actions/workflows/deploy.yaml?query=event%3Aworkflow_dispatch

vklimontovich added a commit that referenced this pull request Jul 23, 2026
…1422)

Follow-up to #1421 (that PR merged before this commit synced into it, so
this change was left behind).

The switcher dropdown showed **two** links to `/workspaces` — a "More
(N)" item **and** "All Workspaces". This removes the duplicate "More"
item and folds the count into the single "All Workspaces" link,
formatted with a thousands separator and shown only when there are more
workspaces than listed inline:

- Before: `More (5738)` + `All Workspaces`
- After: `All Workspaces (5,748)`

JITSU-125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy:console Auto-deploy console to beta when this PR merges (JITSU-68)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant