seed-rs / seed-rs.org

Seed's official website

Home Page:https://seed-rs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Website example sections don't update at page change

PixelPartner opened this issue · comments

When I expand an Example code section and change to the next topic/page, the next example is still expanded and contains the prior content. It needs a page reload to fix that.

Is this related to prerendering or just a plain bug ?

A bug. Fix in the referenced PR.

  • Native browser element <details> has own local state to remember if it's expanded or not. As a result, it isn't automatically closed on the page change. I've fixed it by attaching element keys to details so Seed knows when it should rerender them (it will basically reset the local state).
  • code-block is a custom component that uses Highlight.js in its content wrapped in Shadow DOM. I've refactor it to load code from its attribute code instead of the content. That way Seed is able to correctly determine differences and rerender the element when necessary.
  • Both <details> and code blocks are defined in markdown files so the most changes have been done in build.rs in *.md -> *.html compilation pipeline.

@PixelPartner Changes have been deployed to https://seed-rs.org/, please test it and eventually close the issue. Thanks!