Skip to content

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

@jkelleyrtp

Description

@jkelleyrtp

Problem

A layout in the router is re-mounting when it should not be. This only occurs when the dependencies are at a higher opt-level.

# enabling this causes the layout to remount
[profile.dev.package."*"]
opt-level = 3

I have not seen this in release mode, but in dev with the opt-level increase, it occurs.

This might be because

https://github.com/wheregmis/dioxus/blob/c00b437b81cc0a7ce953cb7e819ada2bd496f3a3/packages/core/src/nodes.rs#L309

If I hardcode static_items_merged to false, then the bug goes away.

Steps To Reproduce

https://github.com/jkelleyrtp/repro-dioxus-layout-remount

Navigate between routes in the dashboard layout. Notice that in debug mode, the layout operates normally. In release mode, it remounts on every nav

Expected behavior

We don't remount layouts. Doing so can cause blinding flashes and resets of data fetching.

Environment:

  • Dioxus version: 0.7.3
  • Rust version: 1.92
  • OS info: Mac
  • App platform: Web

Questionnaire

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions