[FIX] Clear selected item state when switching projects - #3724
Merged
Conversation
muli-cohen
requested changes
Jul 12, 2026
|
|
||
| const projectsList = useMemo(() => { | ||
| const parts = pathname.split('/') | ||
| const basePath = parts.length > 5 ? parts.slice(0, 4).join('/') : pathname |
Collaborator
Author
There was a problem hiding this comment.
@muli-cohen The index at which to slice the path to keep only /projects/:projectName/:section which is the minimum depth of any section root in the app
10 tasks
Collaborator
Author
|
@muli-cohen I Decided to replaced the slice approach because it was fragile. If a new route depth is added, it breaks and the new approach builds the URL from scratch using named constants, so there's no magic number to maintain. |
muli-cohen
approved these changes
Jul 13, 2026
muli-cohen
pushed a commit
that referenced
this pull request
Jul 13, 2026
…switch (#3725) <!-- Title structure should start with a flag - either of these: [FEAT] [FIX] [CHORE] [CI] [DOCS] [STYLE] [REFACTOR] [TEST] [BUILD] [PERF] Followed by a clear representation - e.g: [STYLE] Reformat components for linting compliance [CI] Run tests on push for all branches [FEAT] Add dark mode toggle in header --> ## 📝 Description <!-- A clear, concise summary of what this PR does. --> <!-- Include context, motivation, or related issues (e.g., "Replaces Sass with CSS Modules"). --> Two issues with the Nuclio module federation integration: 1. The breadcrumb did not show the function name when navigating into a Nuclio function - unlike datasets, models and other pages which correctly display the item name. 2. Switching projects while inside a Nuclio page did not reset the MF app - the previous function's state persisted in the new project context. --- ## 🛠️ Changes Made <!-- List the main updates in this PR. --> <!-- Example: - Replaced Sass styles with CSS Modules - Updated Button component props for accessibility - Adjusted CI workflow to run on push for all branches --> - Derive the function name from the URL wildcard (`params['*']`) and pass it as `itemName` to `<Breadcrumbs />` — since Nuclio owns its own routing internally, the function name lives in the wildcard rather than a named route param - Add `key={params.projectName}` to `<ErrorBoundary>` so the entire MF app subtree unmounts and remounts fresh when the project changes, resetting all internal Nuclio state - Re-run the MF init effect on `params.projectName` change to reset `ready`/`error` state between projects --- ## ✅ Checklist - [x] I have given the PR a well-structured title describing the domain and the specific change that was made - [x] I tested the changes in the browser (locally or via preview build) - [x] I confirmed that existing tests pass - [ ] I added or updated unit / integration tests (if needed) - [x] I checked that this change doesn’t introduce new console warnings or lint / formatting errors - [x] I updated the relevant Jira ticket with the appropriate details and status --- ## 🔗 References - Related ticket / issue: https://ecliptos.atlassian.net/browse/ORIS-3081 - Figma / design spec: - Documentation: --- ## 🚨 Potentially Breaking Changes - [ ] Yes - [x] No <!-- If yes, describe what breaks and how to migrate: --> <!-- Example: Renamed prop `variant` → `type` in Button component --> --- Includes DRC change - [ ] Yes - [x] No If yes -> requires bump NPM version --- ## 🔍 Additional Notes <!-- Optional: other context, performance considerations, or follow-up work --> <!-- Example: - TODO: Migrate remaining components away from Sass - Known issue: minor layout flicker on mobile --> - Stale function name in URL on project switch is resolved by [#3724](#3724) --- ## 📸 Screenshots / Demos <!-- Include before/after screenshots, GIFs, or video demos if the change affects UI. --> <!-- You can drag and drop images here directly in the PR. --> ---
pini-sh-panda
pushed a commit
to pini-sh-panda/ui
that referenced
this pull request
Jul 21, 2026
<!-- Title structure should start with a flag - either of these: [FEAT] [FIX] [CHORE] [CI] [DOCS] [STYLE] [REFACTOR] [TEST] [BUILD] [PERF] Followed by a clear representation - e.g: [STYLE] Reformat components for linting compliance [CI] Run tests on push for all branches [FEAT] Add dark mode toggle in header --> ## 📝 Description <!-- A clear, concise summary of what this PR does. --> <!-- Include context, motivation, or related issues (e.g., "Replaces Sass with CSS Modules"). --> When a user had an item's detail pane or version history open (on Jobs, Real-time pipelines, or Artifacts pages) and switched projects via the sidebar dropdown, the URL was naively replacing the project name in place. This kept the artifact/item-specific segments in the URL, causing the next network request to still reference the previous project's item instead of loading a clean state for the new project. The fix strips artifact-specific path segments on project switch, so the user always lands on the section's main list of the new project with no leftover item context. --- ## 🛠️ Changes Made <!-- List the main updates in this PR. --> <!-- Example: - Replaced Sass styles with CSS Modules - Updated Button component props for accessibility - Adjusted CI workflow to run on push for all branches --> - `ProjectDropdown.jsx`: compute `basePath` before building project links - when the current path is deeper than depth 5 (i.e. an item is selected), strip back to `/projects/:projectName/:section` - `ProjectDropdown.test.jsx`: added `EllipsisTooltip` to the mock (was missing) and a new `project switch navigation` describe block with 7 test cases covering flat sections (depth 4), sub-tab main pages (depth 5), and selected-item pages (depth 6+) --- ## ✅ Checklist - [x] I have given the PR a well-structured title describing the domain and the specific change that was made - [x] I tested the changes in the browser (locally or via preview build) - [x] I confirmed that existing tests pass - [x] I added or updated unit / integration tests (if needed) - [x] I checked that this change doesn’t introduce new console warnings or lint / formatting errors - [x] I updated the relevant Jira ticket with the appropriate details and status --- ## 🔗 References - Related ticket / issue: https://ecliptos.atlassian.net/browse/ML-12831 - Figma / design spec: - Documentation: --- ## 🚨 Potentially Breaking Changes - [ ] Yes - [x] No <!-- If yes, describe what breaks and how to migrate: --> <!-- Example: Renamed prop `variant` → `type` in Button component --> --- Includes DRC change - [ ] Yes - [x] No If yes -> requires bump NPM version --- ## 🔍 Additional Notes <!-- Optional: other context, performance considerations, or follow-up work --> <!-- Example: - TODO: Migrate remaining components away from Sass - Known issue: minor layout flicker on mobile --> --- ## 📸 Screenshots / Demos <!-- Include before/after screenshots, GIFs, or video demos if the change affects UI. --> <!-- You can drag and drop images here directly in the PR. --> ---
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
When a user had an item's detail pane or version history open (on Jobs, Real-time pipelines, or Artifacts pages) and switched projects via the sidebar dropdown, the URL was naively replacing the project
name in place. This kept the artifact/item-specific segments in the URL, causing the next network request to still reference the previous project's item instead of loading a clean state for the new
project.
The fix strips artifact-specific path segments on project switch, so the user always lands on the section's main list of the new project with no leftover item context.
🛠️ Changes Made
ProjectDropdown.jsx: computebasePathbefore building project links - when the current path is deeper than depth 5 (i.e. an item is selected), strip back to/projects/:projectName/:sectionProjectDropdown.test.jsx: addedEllipsisTooltipto the mock (was missing) and a newproject switch navigationdescribe block with 7 test cases covering flat sections (depth 4), sub-tab main pages(depth 5), and selected-item pages (depth 6+)
✅ Checklist
🔗 References
🚨 Potentially Breaking Changes
Includes DRC change
If yes -> requires bump NPM version
🔍 Additional Notes
📸 Screenshots / Demos