Skip to content

fix: preserve boolean search tags in routes#107

Open
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/314-boolean-search
Open

fix: preserve boolean search tags in routes#107
AlejandroAkbal wants to merge 1 commit intomainfrom
auto-triage/314-boolean-search

Conversation

@AlejandroAkbal
Copy link
Copy Markdown
Member

@AlejandroAkbal AlejandroAkbal commented Mar 15, 2026

Summary

  • switch posts route generation from a single pipe-delimited tags query string to repeated tags query params
  • parse repeated tag values on both the posts page and saved-posts page so encoded boolean-style tags survive reloads and sharing
  • keep request params aligned with the new route format and cover the helper behavior with focused tests

Validation

  • pnpm exec vitest run "test/assets/router-helper.test.ts"

Context

Summary by CodeRabbit

  • Refactor
    • Improved internal handling of tag filtering across posts and saved posts pages. URL tag parameters are now processed more efficiently, ensuring consistent tag filtering behavior throughout the application.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 15, 2026

Walkthrough

The changes introduce dedicated serialization and deserialization helpers for route tags in the routing system. The API is updated to use ITag instead of Tag, and new serializeRouteTags and parseRouteTags functions replace manual tag parsing throughout the codebase.

Changes

Cohort / File(s) Summary
Routing Tag Serialization
assets/js/RouterHelper.ts
New serializeRouteTags and parseRouteTags helper functions added and exported; generatePostsRoute API parameter type changed from Tag[] to ITag[]; query construction now uses dedicated helpers to serialize tags into URL-encoded query values.
Page Components
pages/posts/[domain].vue, pages/premium/saved-posts/[domain].vue
Replaced manual route tag parsing logic with calls to parseRouteTags helper; tag extraction from URL query simplified to single function call; import parseRouteTags from RouterHelper.
Tests
test/assets/router-helper.test.ts
Added test coverage for new parseRouteTags function; updated expectations to match array-based tag query values instead of pipe-joined strings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: switching from pipe-delimited tags to repeated query parameters to preserve boolean search tags across route navigation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch auto-triage/314-boolean-search
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch auto-triage/314-boolean-search
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/assets/router-helper.test.ts (1)

1-48: ⚠️ Potential issue | 🟡 Minor

Tests correctly verify encoding/decoding, but consider integration verification for the full route flow.

The unit tests appropriately verify:

  1. Encoding of special characters (&%26, :%3A)
  2. Multiple tags as array format
  3. Round-trip encoding via parseRouteTags

However, these tests operate on the raw route object without verifying the full flow through Vue Router. While integration tests exist elsewhere in the test suite (e.g., test/pages/posts.test.ts), they don't specifically test tag encoding through the router's navigateTo(). Consider adding a focused integration test to confirm the encoding behavior works correctly end-to-end when used with navigateTo({ ...postsRoute }) in actual page navigation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/assets/router-helper.test.ts` around lines 1 - 48, Add an integration
test that verifies generatePostsRoute and parseRouteTags behavior when routed
through Vue Router by calling navigateTo with the generated route; specifically,
create a test that builds a posts route via generatePostsRoute (using tags with
characters like '&' and ':'), calls navigateTo({ ...route }) or the app's router
push equivalent, then inspects the actual browser/router URL or the
router.currentRoute location and uses parseRouteTags on the resolved query to
assert tags were encoded/decoded correctly. Locate usage around
generatePostsRoute and parseRouteTags in tests and invoke navigateTo (or
router.push) so the assertion covers end-to-end routing rather than only the raw
route object.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@test/assets/router-helper.test.ts`:
- Around line 1-48: Add an integration test that verifies generatePostsRoute and
parseRouteTags behavior when routed through Vue Router by calling navigateTo
with the generated route; specifically, create a test that builds a posts route
via generatePostsRoute (using tags with characters like '&' and ':'), calls
navigateTo({ ...route }) or the app's router push equivalent, then inspects the
actual browser/router URL or the router.currentRoute location and uses
parseRouteTags on the resolved query to assert tags were encoded/decoded
correctly. Locate usage around generatePostsRoute and parseRouteTags in tests
and invoke navigateTo (or router.push) so the assertion covers end-to-end
routing rather than only the raw route object.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f2df44d9-efc9-48bf-bccd-cf51b0ef7e90

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc34fe and fa5dcbc.

📒 Files selected for processing (4)
  • assets/js/RouterHelper.ts
  • pages/posts/[domain].vue
  • pages/premium/saved-posts/[domain].vue
  • test/assets/router-helper.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant