Website example sections don't update at page change
PixelPartner opened this issue · comments
Thomas Kumlehn commented
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 ?
Martin Kavík commented
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 todetails
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 attributecode
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 inbuild.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!