Skip to content

fix: sync org page filters and columns with URL#2996

Open
iamnitishpattar wants to merge 10 commits into
npmx-dev:mainfrom
iamnitishpattar:fix-org-url-sync
Open

fix: sync org page filters and columns with URL#2996
iamnitishpattar wants to merge 10 commits into
npmx-dev:mainfrom
iamnitishpattar:fix-org-url-sync

Conversation

@iamnitishpattar

Copy link
Copy Markdown

🔗 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].vue page to fully synchronize these states with the URL parameters.

📝 Description

  • State Initialization: Added logic to parse route.query.columns on page load to initialize the visibility of the table columns if they are present in the URL.
  • Initial Filters: Passed the downloadRange, security, and updatedWithin URL parameters into useStructuredFilters as initialFilters to ensure the filter chips are correctly restored on load.
  • URL Syncing: Updated the debounced updateUrl function and the Vue watch array to track changes to these filters and the visible columns.
  • Clean URLs are maintained by only appending these parameters when their values differ from the defaults (e.g., ignoring downloadRange: 'any').

@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jul 9, 2026 12:10pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jul 9, 2026 12:10pm
npmx-lunaria Ignored Ignored Jul 9, 2026 12:10pm

Request Review

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @iamnitishpattar! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

URL-driven filter and column state sync

Layer / File(s) Summary
Import structured filter and column defaults
app/pages/org/[org].vue
Replaces the prior preferences import with structured filter-related imports and adds DEFAULT_COLUMNS plus the option and constant sets used for query parsing.
Initialise filters and columns from URL query
app/pages/org/[org].vue
Reads route.query.columns to set column visibility and seeds downloadRange, security, and updatedWithin from matching query values.
Write structured state back to URL
app/pages/org/[org].vue
Extends the debounced URL updater and watcher to write downloadRange, security, updatedWithin, and columns, omitting default values.

Related issues: #2818 — bug: org page filters and selected columns state not reflected in URL

Suggested labels: bug, enhancement

Suggested reviewers: (none specified)

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes meet #2818 by restoring filters and selected columns from the URL and keeping them reflected there.
Out of Scope Changes check ✅ Passed The summary shows a focused change to the org page URL state sync with no obvious unrelated additions.
Title check ✅ Passed The title clearly summarises the main change: syncing org page filters and columns with the URL.
Description check ✅ Passed The description matches the changeset and explains the URL synchronisation work accurately.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/pages/org/[org].vue (1)

108-130: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Magic-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 in useStructuredFilters. 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

📥 Commits

Reviewing files that changed from the base of the PR and between e731a54 and 851286e.

📒 Files selected for processing (1)
  • app/pages/org/[org].vue

Comment thread app/pages/org/[org].vue
@serhalp serhalp added the needs review This PR is waiting for a review from a maintainer label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR is waiting for a review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: org page filters and selected columns state not reflected in URL

2 participants