Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Provide warning if store data cannot be serialized by devalue #447

Open
ispyinternet opened this issue Sep 23, 2018 · 3 comments
Open

Provide warning if store data cannot be serialized by devalue #447

ispyinternet opened this issue Sep 23, 2018 · 3 comments

Comments

@ispyinternet
Copy link

When you set store data on the server, if it cannot be serialized by devalue (objects containing functions are one such case), your client side will not receive a copy of the store in the init runtime. There are no warnings and for newbies this could be a source of confusion. Suggest a warning message to console server side and possible even set an error message in the store to warn the client side?

@ansarizafar
Copy link

We should be able to pass a context object (like Graphql) to page/server routes and components both on server and client. The context object should be available as this.context like this.store. In my opinion its a must have feature.

@dxlbnl
Copy link

dxlbnl commented Dec 10, 2018

Here :)

function try_serialize(data: any) {
try {
return devalue(data);
} catch (err) {
return null;
}
}

@PatrickG
Copy link
Member

I just stumbled across this issue.
This is fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants