Skip to content

Commit

Permalink
feat(history-sync): enable usage of codec with Future API
Browse files Browse the repository at this point in the history
  • Loading branch information
XiNiHa committed Nov 16, 2024
1 parent f1dcb56 commit 745ac22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sweet-hotels-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-history-sync": minor
---

Enable usage of `encode` and `decode` with Future API as `encodePath` and `decodePath`
8 changes: 7 additions & 1 deletion extensions/plugin-history-sync/src/historySyncPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type ConfigHistorySync = {
declare module "@stackflow/config" {
interface ActivityDefinition<ActivityName extends string> {
path: string;
decodePath?: (params: Record<string, string>) => Record<string, unknown> | null;
encodePath?: (params: Record<string, unknown>) => Record<string, string>;
}

interface Config<T extends ActivityDefinition<string>> {
Expand Down Expand Up @@ -74,7 +76,11 @@ export function historySyncPlugin<
: options.config.activities.reduce(
(acc, a) => ({
...acc,
[a.name]: a.path,
[a.name]: {
path: a.path,
decode: a.decode,
encode: a.encode,
},
}),
{},
);
Expand Down

0 comments on commit 745ac22

Please sign in to comment.