Skip to content

[frontend] feat(multi-tenant): strip detail segments on tenant switch (#4864)#5589

Merged
corinnekrych merged 8 commits intorelease/currentfrom
issue/4864-url-fallback-2
Apr 29, 2026
Merged

[frontend] feat(multi-tenant): strip detail segments on tenant switch (#4864)#5589
corinnekrych merged 8 commits intorelease/currentfrom
issue/4864-url-fallback-2

Conversation

@corinnekrych
Copy link
Copy Markdown
Contributor

@corinnekrych corinnekrych commented Apr 24, 2026

… (#4864)

When a user views a detail page (e.g. {tenant-id}/admin/scenarios/{scenario-id}) and switches to another tenant, the page reloads keeping the entity ID (ie: {scenario-id}) in the URL.
The frontend URL becomes stale, showing an entity ID that doesn't exist in the new tenant. This results in a 404 error (once BE is fixed) and a confusing user experience.

Proposed changes

  • When switching tenant, strip the details part of the URL to make sure we land on the list of entity rather than the entity detail page

Testing Instructions

  1. log in as admin
  2. create tenant A
  3. create tenant B
  4. in tenant A create sceanrio A
  5. switch to tenant B in tenant switcher
    and see how we lan in list of scanearios

Related issues

  • Closes #ISSUE-NUMBER

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions Bot added the filigran team use to identify PR from the Filigran team label Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.77%. Comparing base (215ea68) to head (3a8c795).
⚠️ Report is 47 commits behind head on release/current.

Additional details and impacted files
@@                Coverage Diff                 @@
##             release/current    #5589   +/-   ##
==================================================
  Coverage              63.77%   63.77%           
  Complexity              5848     5848           
==================================================
  Files                   1147     1147           
  Lines                  34494    34494           
  Branches                2658     2658           
==================================================
  Hits                   21999    21999           
  Misses                 11194    11194           
  Partials                1301     1301           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@corinnekrych corinnekrych marked this pull request as ready for review April 24, 2026 13:00
* → "/admin/scenarios"
* "/admin/scenarios" → "/admin/scenarios" (unchanged)
*/
export const stripDetailSegments = (pathname: string): string => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems a bit fragile to me. For example, if you’re on a list page and then switch tenant, but you don’t have access to that list in the new tenant, you’ll get an error as well.

Could we do something similar to what we do after login at first ?

Copy link
Copy Markdown
Contributor Author

@corinnekrych corinnekrych Apr 28, 2026

Choose a reason for hiding this comment

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

You mean loosing context and forward to home page?
The goal here was to allow end user to switch between tenant keeping context. For ex if a tenant user browse teams in tenantA and wants to check tenantB's teams.
In case the user has no read access to scenario, he will fallback to existing RBAC alert.

@corinnekrych
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…ant import conflict (#4864)

Co-authored-by: corinnekrych <1395710+corinnekrych@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in commit 6bfb3c9. The conflict was in useTenant.ts — the import path was updated from ../tenant-url-helper to ../url-helper (which is where the functions live after the release/current refactor), while keeping stripDetailSegments in the import.

@corinnekrych corinnekrych merged commit 6ef3045 into release/current Apr 29, 2026
14 checks passed
@corinnekrych corinnekrych deleted the issue/4864-url-fallback-2 branch April 29, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants