Skip to content

Switch to a const hash instead of comparing pointers for template diffing#5276

Open
ealmloff wants to merge 4 commits intoDioxusLabs:mainfrom
ealmloff:const-template-hash
Open

Switch to a const hash instead of comparing pointers for template diffing#5276
ealmloff wants to merge 4 commits intoDioxusLabs:mainfrom
ealmloff:const-template-hash

Conversation

@ealmloff
Copy link
Member

@ealmloff ealmloff commented Jan 30, 2026

Currently we compare templates in two different ways depending on the opt level of dioxus-core:

  1. By content if static functions aren't merged when building core
  2. By pointer if static functions are merged

This causes issues if dioxus-core is built at a higher level than dioxus itself.

This PR changes the comparison to always compare by a hash which is created at compile time for const templates (or at runtime for hot reloaded templates). Unfortunately, this requires a new field on template which previously only had public fields which makes this change breaking.

Fixes #5274

@ealmloff ealmloff added bug Something isn't working core relating to the core implementation of the virtualdom breaking This is a breaking change labels Jan 30, 2026
@ealmloff ealmloff changed the title switch to a const hash Switch to a const hash instead of comparing pointers for template diffing Jan 30, 2026
@ealmloff ealmloff marked this pull request as ready for review January 30, 2026 18:48
@ealmloff ealmloff requested a review from a team as a code owner January 30, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking This is a breaking change bug Something isn't working core relating to the core implementation of the virtualdom

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layouts get re-mounted in when opt-level > 1

1 participant