Don't send component logic to client conditionally on data?
Hey everyone! I'm trying to wrap my head around this use case and can't understand how one would do it in SolidStart, if someone can help.
In full SSR world:
Very simple: on the server I have a backend request that tells me if user has permission A or not.
Then, I have logic regarding that permission A to show or not show various components.
How can I remove the unused bits from components? does it get removed by default? I don't want to show users without permission A either logic or hidden components in the JS
2 Replies
Either hope for good code splitting, or somewhat force it yourself by putting that hidden component in a separate module which get's lazy loaded (https://www.solidjs.com/docs/latest/api#lazy) when rendered (conditional on your permission via a <Show>).
This would however only obfuscate, the components logic is still very much in the built javascript, which anyone could download and inspect
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
That's great! thanks, hadn't read lazy part of the api yet.
I wonder if there's something I could do in server$ functions in regards of the code never making it to the client, instead of purely obfuscating