Skip to content

Conversation

@orionmiz
Copy link
Collaborator

@orionmiz orionmiz commented Jan 29, 2026

Summary

  • Add encode option to Route interface in plugin-history-sync
  • The encode function converts activity params to URL string params (reverse of decode)

Example

const routes = {
  SearchActivity: {
    path: "/search",
    decode: (params) => ({
      filter: JSON.parse(params.filter),
    }),
    encode: (params) => ({
      filter: JSON.stringify(params.filter),
    }),
  },
};

Test plan

  • Added test for encode function with JSON.stringify
  • All existing tests pass

@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: 324c6cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stackflow/plugin-history-sync Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added encode configuration option for routes to customize how activity parameters are converted to URL-encoded format, providing symmetrical encoding alongside existing decode functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This pull request introduces encoding support to the route configuration system by adding an optional encode function to the Route interface. The encode function transforms activity parameters into URL-safe string parameters, complementing the existing decode function. Implementation changes apply encoding during path construction when configured.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/purple-chefs-greet.md
Changeset entry documenting minor version bump for @stackflow/plugin-history-sync with encode option addition.
Route Interface Enhancement
extensions/plugin-history-sync/src/RouteLike.ts
Added optional encode method to Route type that transforms params into URL-safe string mappings, mirroring the existing decode function.
Template Implementation
extensions/plugin-history-sync/src/makeTemplate.ts
Expanded makeTemplate to destructure encode from Route config; modified fill method signature to accept any object type and apply encoding transformation before path/search params construction.
Test Coverage
extensions/plugin-history-sync/src/makeTemplate.spec.ts
New test case verifying encode function can transform complex objects (like nested filter params) into JSON-stringified and URL-encoded query strings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings

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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 29, 2026

commit: 324c6cb

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 29, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
stackflow-docs 324c6cb Commit Preview URL Jan 29 2026, 07:58 AM

Add encode function to convert activity params to URL string params,
complementing the existing decode function for the reverse operation.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@orionmiz orionmiz force-pushed the vk/b077-history-sync-rou branch from c949856 to 324c6cb Compare January 29, 2026 07:38
@cloudflare-workers-and-pages
Copy link

Deploying stackflow-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 324c6cb
Status: ✅  Deploy successful!
Preview URL: https://1ebb95f5.stackflow-demo.pages.dev
Branch Preview URL: https://vk-b077-history-sync-rou.stackflow-demo.pages.dev

View logs

@orionmiz orionmiz marked this pull request as ready for review January 29, 2026 07:42
@orionmiz orionmiz merged commit 45fb7ba into main Jan 29, 2026
7 of 9 checks passed
@orionmiz orionmiz deleted the vk/b077-history-sync-rou branch January 29, 2026 07:42
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.

2 participants