-
Notifications
You must be signed in to change notification settings - Fork 293
bootPlaygroundRemote: Defer setting the iframe src initially, to prevent flash of unstyled content #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootPlaygroundRemote: Defer setting the iframe src initially, to prevent flash of unstyled content #519
Conversation
…h of unstyled content This allows the src attribute to be set later when client is ready, e.g., afer blueprint steps are run and desired theme activated
Thinking about this more, what does it to to a website? Does it still loading the homepage in that iframe? AFAIR it should because it uses a Blueprint with a landingPage which always loads a page in the end, but just wanted to confirm. All the more reasons to use Blueprints. Would you also document this change in the place where you'd expect to find such info? The doc site lives in |
@eliot-akira I've been noodling on this for a while now and I'm quite confident this is fine. The only side-effect is that opening |
Preferably something semantically related to the goal. Another question is whether this (option) is necessary at all. Is there a reason not to wait until the Playground is ready to route the iframe? |
I wonder if we could consider
How about a new optional query parameter That would make it an opt-in behavior to set the iframe src initially (before blueprint steps are run). If not set, then by default To confirm that it does this currently, I looked in the playground client's It calls This await (playground as any).goTo(
blueprint.landingPage || '/'
); ..to be inside the try/catch (EDIT: That seems like a good idea in any case, I made a commit 881f508 to move it.) |
… so that it runs even when a blueprint step throws
Oki I'm on board and I think this makes sense. I don't even think we need the URL parameter. This is even better because the blank page makes it apparent there's something wrong with using
You have to explicitly embed it to use it, though, but yeah I no longer think it needs to render anything by default. |
What?
Removes a line in
bootPlaygroundRemote
that initially sets iframe src to route/
.This pull request defers setting the
src
attribute, letting the client set it when the website is ready, e.g., afer blueprint steps are run and desired theme activated.Possibly this could be an opt-in behavior.
Why?
Prevents flash of unstyled content, for example, when a default theme is shown before switching to a newly installed theme.
How?
Should check if this doesn't break something unexpected. The PR will require all callers of
bootPlaygroundRemote
to set the iframe src themselves. Otherwise it will stay empty.Testing Instructions
npm run dev
.