Giter VIP home page Giter VIP logo

Comments (8)

arctic-hen7 avatar arctic-hen7 commented on May 30, 2024

@lukechu10 would you be able to shine any light on this? (Note: it occurs with and without hydration.)

from perseus.

lukechu10 avatar lukechu10 commented on May 30, 2024

It's a FOUC (Flash Of Unstyled Content). If you go into the browser devtool's network tab, you can block the style.css and then the issue is solved. The elements already have some inline styling so that is shown first before the css file is loaded.

I think the problem is that when navigating, perseus replaces the entire <head> and not just the dynamic part. This causes the style.css file to be re-fetched. I think the intended behavior should be that the static part provided by the index_view should never be modified.

Also there is another "jolt" when loading the page. This jolt seems to coincide with the addition of the route announcer. This might be a problem with the CSS and therefore adding a new node changes the behavior of the CSS selector.

from perseus.

lukechu10 avatar lukechu10 commented on May 30, 2024

Also there is another "jolt" when loading the page. This jolt seems to coincide with the addition of the route announcer. This might be a problem with the CSS and therefore adding a new node changes the behavior of the CSS selector.

Actually, that's because the SSR-ed HTML is for some reason different from the hydrated HTML. There is an additional <div> around the <header> once the HTML is hydrated.

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 30, 2024

Perseus doesn't actually replace the whole head in content, but in terms of mechanics it does. That can probably be faiy easily fixed, since the delimiter functionality of what not to replace is already built in.

As for the initial load part, that's just because we can't put the dynamic view inside the router at the root yet. I did reflect that in the server side HTML at some point, though I seem to have removed it.

A plan of action then would be to add that div back and modify the head replacement logic on the client side to not delete and re-add elements that shouldn't change. I'll get on with that today.

Greatly appreciated, @lukechu10 !

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 30, 2024

Intriguingly, this seems to go away when just fixing the issue with the extra <div> not being provided by the server...

from perseus.

lukechu10 avatar lukechu10 commented on May 30, 2024

Intriguingly, this seems to go away when just fixing the issue with the extra <div> not being provided by the server...

Yeah that's because the CSS styles differently depending on whether the div is there or not.

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 30, 2024

That would make sense on the first load, but in subsequent loads, the render is direct to that <div>... Am I missing something really obvious here?

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 30, 2024

The old head delimiter comment has now been replaced by a <meta itemprop="__perseus_head_boundary" content=""> element, which can be used as a marker to delete anything after it and replace it, avoiding any interaction with the static content before it that's shared between all pages.

from perseus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.