3 ms·
This is probably obvious but why is the existence of singletons what destroys "isomorphism"?
by tel 11y ago
This is probably obvious but why is the existence of singletons what destroys "isomorphism"?
- billybolero 11y agoBecause that singleton will serve multiple requests on the server, requests from different users. Singletons are more okay on the client because you know you'll only serve one user, so the singleton can make that assumption as well. But that doesn't work on the server, since the singleton is serving more than one user. You can still use singletons on the server, but you have to pass the current user id to every method/event on that singleton. And that ends up being quite annoying.
- tel 11y agoAh, I see. Thanks.
- efdee 11y agoOn the serverside, your stores should not be singletons (shared between all requests) but in request scope (one per request). Otherwise users will be reading eachother's data.