-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: browser back button functionality in merchant report page (BAL-3296) #2927
Conversation
|
WalkthroughThis pull request introduces version 0.7.90 of the Changes
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant MerchantReportPage
participant URLHandler
User->>MerchantReportPage: Navigate to page
MerchantReportPage->>URLHandler: Update search params
URLHandler->>Browser: Replace URL state
Browser-->>User: Smooth back button navigation
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx (2)
Line range hint
28-32
: Consider removing the@ts-expect-error
comment.You're creating an enum from values derived at runtime (
tabs.map(tab => tab.value)
), which naturally conflicts with the static nature ofz.enum()
. While the@ts-expect-error
directive suppresses the type error, consider a more type-safe approach to define the valid tabs. For example, you can create a literal type array fortabsValues
or handle it more explicitly.
Line range hint
10-16
: Optional improvement to avoid fetching on undefined ID.When
businessReportId
isundefined
, you’re passing an empty string (''
) as the fetch ID. Even though the hook gracefully handles the case, consider conditionally skipping the fetch ifbusinessReportId
is undefined to avoid unnecessary calls.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/backoffice-v2/CHANGELOG.md
(1 hunks)apps/backoffice-v2/package.json
(1 hunks)apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/backoffice-v2/package.json
🔇 Additional comments (3)
apps/backoffice-v2/CHANGELOG.md (1)
3-8
: LGTM! The changelog entry is well-formatted and accurately describes the changes.
The changelog entry:
- Follows the conventional commit format
- Correctly categorizes the change as a patch
- Provides a clear and concise description that matches the PR objectives
apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx (2)
Line range hint 35-41
: Validate the navigation fallback logic.
The onNavigateBack
logic navigates to '../'
if the session storage doesn't contain a previous-path
. This may cause unexpected behavior if your directory structure changes or if the user expects a more context-specific fallback. Consider a more explicit fallback route or a default behavior that's consistent with your overall application routing.
42-42
: Great use of replace: true
for improved browser back button behavior.
Using { replace: true }
ensures the URL search parameters are updated without adding another entry to the browser’s history stack, aligning perfectly with the PR objective to enhance back button functionality. This change looks solid and should help avoid confusing history rewrites.
Changes
replace
property in theuseZodSearchParams
function to be passed to the correspondingreact-router-dom
function, which eliminates non-user-friendly history rewrites.Summary by CodeRabbit
Bug Fixes
Version Update