salesforce / lightning-labs

MIT License
3 stars 4 forks source link

Props set in playground should be evaluated in the server for the SSR preview #17

Open cardoso opened 1 month ago

cardoso commented 1 month ago

Currently setting the component props in playground will evaluate inside the playground's context (browser), lacking access to the server-side environment such as global variables and classes.

The playground README.md seems to imply it should be evaluated in the server-side.

The props don't have to be strings, and they don't even have to be serializable JavaScript objects. Any JavaScript expression that could be evaluated in an SSR enviroment should be supported.

Here's an easy to reproduce example using Date.now():

Set in code

Screenshot 2024-06-07 at 22 52 01

Set in playground

Screenshot 2024-06-07 at 22 52 26

I'm still getting familiar with the project, so maybe some of the above isn't in line with the intended purpose, but in that case it can be clarified in the docs or UI.