Skip to content

Commit

Permalink
fix: parse routerDataFnArgs in mergeLoaderData function
Browse files Browse the repository at this point in the history
  • Loading branch information
targeral committed Nov 1, 2024
1 parent b6acb98 commit 1c28a94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/fifty-starfishes-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/runtime': patch
---

fix: parse `routerDataFnArgs` in `mergeLoaderData` function
fix: 在 `mergeLoaderData` 函数中解析 routerDataFnArgs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ export const preResolvedFnStr = `function p(e,r){return void 0!==r?Promise.rejec
* Abstracting the above logic to `mergeLoaderData`:
* function mergeLoaderData (routeIdJsonStr, deferredKeyPromiseManifests) {
const source = deferredKeyPromiseManifests.reduce(function(o, {key, routerDataFnName, routerDataFnArgs }) {
return {...o, [key]: _ROUTER_DATA[routerDataFnName](...routerDataFnArgs)}
const args = routerDataFnArgs.map(arg => JSON.parse(arg));
return {...o, [key]: _ROUTER_DATA[routerDataFnName](...args)};
}, {});
Object.assign(_ROUTER_DATA.loaderData[routeIdJsonStr], source);
};
*/
export const mergeLoaderDataStr = `function mergeLoaderData(a,e){e=e.reduce(function(a,{key:e,routerDataFnName:r,routerDataFnArgs:t}){return{...a,[e]:_ROUTER_DATA[r](...t)}},{});Object.assign(_ROUTER_DATA.loaderData[a],e)}`;
export const mergeLoaderDataStr = `function mergeLoaderData(t,a){const e=a.reduce((function(t,{key:a,routerDataFnName:e,routerDataFnArgs:r}){const n=r.map((t=>JSON.parse(t)));return{...t,[a]:_ROUTER_DATA[e](...n)}}),{});Object.assign(_ROUTER_DATA.loaderData[t],e)}`;

0 comments on commit 1c28a94

Please sign in to comment.