fix(navigation): respect backLabel state in BackButton#1117
Open
Khaostica wants to merge 1 commit into
Open
Conversation
BackButton read `state.backTo` from location state, but every caller passes `state.backLabel` (20+ sites: MinerPRsTable, RepositoryPRsTable, HomePage, WatchlistPage, BountySidebar, etc.). The key mismatch meant the displayed label always fell back to the hardcoded `label` prop on the destination page, so e.g. navigating to a PR from a miner's pull-requests tab rendered "Back to Repositories" instead of "Back to <miner>". Click behavior was already correct because of `navigate(-1)` when history exists. Only the label was wrong, which made it confusing rather than functionally broken. Now reads `state.backLabel` and uses it as the label when present, falling back to the `label` prop otherwise. All existing callers benefit without needing to change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
BackButtonread navigation state with the keybackTo, but every caller across the codebase passesbackLabel(20+ sites:MinerPRsTable,RepositoryPRsTable,HomePage,WatchlistPage,BountySidebar, etc.). The key mismatch meant the rendered label always fell through to the destination page's hardcodedlabelprop, so every caller's intent was silently dropped.Visible symptom: opening a PR from a miner's Pull Requests tab shows "Back to Repositories" in the top-left even though the user came from the miner page. Click behavior was already correct (
navigate(-1)), so this was confusing rather than functionally broken.Fix:
BackButtonnow readsstate.backLabeland uses it as the label when present, falling back to thelabelprop otherwise. All 20+ existing callers benefit without any changes on their side.Related Issues
None
Type of Change
Screenshots
Before:

After:

Additional Videos
Before:
https://github.com/user-attachments/assets/ec96b4be-9264-426d-855a-b7bf8262ab7a
After:
https://github.com/user-attachments/assets/a45a5a33-0e69-4478-9688-8e8a9ac79713
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses