fix(weave): Prevent Double URL State Update in ButtonOverlay Navigation #3935
+10
−17
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
Fix: Prevent Double URL State Update in ButtonOverlay Navigation
Problem
When clicking a ButtonOverlay component to navigate to a new URL, the navigation process was creating an unnecessary history entry. This happened because:
cols
parameter)Solution
I refactored the column visibility state management to separate concerns:
This solution works because:
Alternative Solutions Analysis
I considered several alternative approaches to solve this issue, but each had limitations:
1. Direct
history.replace
insetColumnVisibilityModel
Why it doesn't work:
setColumnVisibilityModel
is used in many other occasions where we expect a new history record to appear when users manually change column visibility settingshistory.replace
or skip history updates, it would break the expected behavior in those cases2. Add a Navigation Flag to CallsTable
Why it doesn't work that well:
history.replace
during navigation, it's an ugly solution3. Check if CallsTable is mounted to decide replace/push
Why it doesn't work:
4. Dismount CallsTable with keys based on page type
Why it doesn't work:
history.replace
, it has significant drawbacks5. Pre-inject the
cols=
parameter.Modified the ButtonOverlay component to preserve the current column visibility state during navigation:
-. Before navigation, we capture the current
cols
parameter from the URL-. We construct the target URL with the existing column visibility state
-. The downside of this approach is that we manage the URL update in multiple places.
-. This approach is not bullet-proof, it is susceptible to external changes.
This ensures that when we navigate, we're already including the column visibility state, preventing the CallsTable from needing to update the URL again.
The key insight was that instead of trying to prevent the column visibility update from happening, I should ensure it's already included in the navigation URL. This way, there's no need for a second URL update.
Testing
Manually tested FE code against production data locally. I also tested against the production behavior today, there are no additional visibility entries added or removed.