From 745ac228ebe4c7715be693245a67e6a87e8e7d22 Mon Sep 17 00:00:00 2001 From: Iha Shin Date: Fri, 15 Nov 2024 16:05:32 +0900 Subject: [PATCH] feat(history-sync): enable usage of codec with Future API --- .changeset/sweet-hotels-sleep.md | 5 +++++ extensions/plugin-history-sync/src/historySyncPlugin.tsx | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/sweet-hotels-sleep.md diff --git a/.changeset/sweet-hotels-sleep.md b/.changeset/sweet-hotels-sleep.md new file mode 100644 index 00000000..6dfa6e9f --- /dev/null +++ b/.changeset/sweet-hotels-sleep.md @@ -0,0 +1,5 @@ +--- +"@stackflow/plugin-history-sync": minor +--- + +Enable usage of `encode` and `decode` with Future API as `encodePath` and `decodePath` diff --git a/extensions/plugin-history-sync/src/historySyncPlugin.tsx b/extensions/plugin-history-sync/src/historySyncPlugin.tsx index e9a821a5..9276cdf8 100644 --- a/extensions/plugin-history-sync/src/historySyncPlugin.tsx +++ b/extensions/plugin-history-sync/src/historySyncPlugin.tsx @@ -25,6 +25,8 @@ type ConfigHistorySync = { declare module "@stackflow/config" { interface ActivityDefinition { path: string; + decodePath?: (params: Record) => Record | null; + encodePath?: (params: Record) => Record; } interface Config> { @@ -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, + }, }), {}, );