Skip to content

Commit 0a105c3

Browse files
committed
feat(history-sync): enable usage of codec with Future API
1 parent 04f54c2 commit 0a105c3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/sweet-hotels-sleep.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-history-sync": minor
3+
---
4+
5+
Enable usage of `encode` and `decode` with Future API

extensions/plugin-history-sync/src/historySyncPlugin.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type ConfigHistorySync = {
2525
declare module "@stackflow/config" {
2626
interface ActivityDefinition<ActivityName extends string> {
2727
path: string;
28+
decode?: (params: Record<string, string>) => Record<string, unknown>;
29+
encode?: (params: Record<string, unknown>) => Record<string, string>;
2830
}
2931

3032
interface Config<T extends ActivityDefinition<string>> {
@@ -74,7 +76,11 @@ export function historySyncPlugin<
7476
: options.config.activities.reduce(
7577
(acc, a) => ({
7678
...acc,
77-
[a.name]: a.path,
79+
[a.name]: {
80+
path: a.path,
81+
decode: a.decode,
82+
encode: a.encode,
83+
},
7884
}),
7985
{},
8086
);

0 commit comments

Comments
 (0)