-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Description
When dehydrate RouteStore on server side, the value contains action of RouteStore.
I’m in troubled that transpiled code is exported to client side by server side setting.
I want the dehydrated value of RouteStore to be abstracted as before.
RouteStore
RouteStore.withStaticRoutes({
index: {
path: '/',
handler: IndexComponent,
action: async (context) => {
await Promise.all([
context.executeAction(FooAction, {}),
context.executeAction(BarAction, {}),
]);
},
}
})v0.4.x dehydrated value
{
"RouteStore":{
"currentUrl":"\u002F",
"currentNavigate":{
"transactionId":2953444313308840,
"url":"\u002F",
"config":{},
},
"currentNavigateError":null,
"isNavigateComplete":true,
"routes":null
}
}v1.0.0 dehydrated value
{
"RouteStore":{
"currentNavigate":{
"transactionId":6733112344216282,
"url":"\u002F",
"config":{}
"route":{
"path":"\u002F",
"handler":function StoreConnector(props, context) {
React.Component.apply(this, arguments);
this.state = this.getStateFromStores();
this._onStoreChange = null;
this._isMounted = false;
},
"action":async (context) => {
await Promise.all([
context.executeAction(FooAction, {}),
context.executeAction(BarAction, {}),
]);
},
"method":"GET",
"name":"index",
"url":"\u002F",
"params":{},
"query":{}
},
"error":null,
"isComplete":true
},
"routes":null
}
}Steps to reproduce the behavior
- Transpile javascript with different babel settings on server and client.
- server:['env', { targets: { node: 'current' } }]
- client:['env', { targets: { browsers: [...] } }] - Set async function in
actionto create RouteStore. - Embed the serialized dehydrate value in the template and render it.
- Open in browser that not compatible with
async/await.
-SyntaxError: Unexpected token '=>'
-Error: `rehydrate` called with a non-object. Ensure that the parameter passed to rehydrate is a state object produced by a dehydrate call.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels