fix: sync org page filters and columns with URL#2996
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Hello! Thank you for opening your first PR to npmx, @iamnitishpattar! 🚀 Here’s what will happen next:
|
📝 WalkthroughWalkthroughThe org page now synchronises structured filter state and visible columns with URL query parameters on load and during debounced updates, alongside the existing text and sort query syncing. ChangesURL-driven filter and column state sync
Related issues: Suggested labels: bug, enhancement Suggested reviewers: (none specified) 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/pages/org/[org].vue (1)
108-130: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMagic-string defaults ('any'/'all') duplicated from the filters composable.
The omit-if-default checks hardcode
'any'/'all'here, separate from wherever these defaults are actually defined inuseStructuredFilters. If those defaults ever change, this logic silently breaks (URL params stop being omitted correctly).Consider exporting the default values as named constants from the filters composable/types module and reusing them here instead of inline string literals.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/pages/org/`[org].vue around lines 108 - 130, The URL update logic in updateUrl duplicates filter default sentinels by hardcoding 'any' and 'all', which can drift from the real defaults in useStructuredFilters. Replace those inline checks with shared named constants exported from the filters composable/types module and reuse them in the router.replace query building so the omit-if-default behavior stays aligned if defaults change. Ensure the comparison for downloadRange, security, and updatedWithin uses those imported defaults rather than string literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/pages/org/`[org].vue:
- Around line 80-84: The initialFilters mapping in org/[org].vue is trusting
route.query.downloadRange, route.query.security, and route.query.updatedWithin
via direct type assertions, which bypasses type safety for user-controlled
input. Update the initialFilters construction to validate each normalized query
value against the allowed members of DownloadRange, SecurityFilter, and
UpdatedWithin before assigning it, and fall back to undefined for anything
invalid. Use the existing initialFilters object and normalizeSearchParam helper
as the main entry points, but avoid casting unknown query values directly into
the union types.
---
Nitpick comments:
In `@app/pages/org/`[org].vue:
- Around line 108-130: The URL update logic in updateUrl duplicates filter
default sentinels by hardcoding 'any' and 'all', which can drift from the real
defaults in useStructuredFilters. Replace those inline checks with shared named
constants exported from the filters composable/types module and reuse them in
the router.replace query building so the omit-if-default behavior stays aligned
if defaults change. Ensure the comparison for downloadRange, security, and
updatedWithin uses those imported defaults rather than string literals.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fcc6069e-ea9f-4663-83d8-fff43ac164c8
📒 Files selected for processing (1)
app/pages/org/[org].vue
🔗 Linked issue
resolves #2818
🎯 Context
Currently, on the organization page, the selected filters (like download range, security, updated within) and the customized table columns are not synced to the URL. This prevents users from sharing links that preserve their specific view state.
This PR updates the
[org].vuepage to fully synchronize these states with the URL parameters.📝 Description
route.query.columnson page load to initialize the visibility of the table columns if they are present in the URL.downloadRange,security, andupdatedWithinURL parameters intouseStructuredFiltersasinitialFiltersto ensure the filter chips are correctly restored on load.updateUrlfunction and the Vuewatcharray to track changes to these filters and the visible columns.downloadRange: 'any').