DioxusLabs / DioxusLabs/dioxus

`dx serve --hot-patch` only displays the correct output AFTER hotpatching [fullstack] [minimal example included]

Open
#5,168 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

In fullstack mode the page is not loaded correctly initially

**Steps To Reproduce**
https://github.com/srivatsasrinivasmath/dioxus_asset_bug/

````rust
//Bug: CSS classes not applied correctly on initial fullstack build
// The desired output is achieved without fullstack. On full stack it is achieved after a hot-patch
// Try editing the p tag which says "Superfluous"
// The input should have a red box-shadow when the page is first opened

use dioxus::prelude::*;

use crate::components::input::Input;

const COMPONENTS: Asset = asset!("/assets/dx-components-theme.css");

fn main() {
dioxus::launch(App);
}

#[component]
fn App() -> Element {
let mut store: Store> = use_store(|| None);
rsx! {
document::Link { rel: "stylesheet", href: COMPONENTS}
div{
SomeInput {
store,
error_condition: move |str: String|{
match str.parse::(){
Ok(val) => Some(val),
_ => None,
}
}
}
//Change the below and the desired behavior appears
p{
"Superfluous"
}
}
}
}

mod components;

#[component]
fn SomeInput(
store: Store>,
error_condition: Callback>,
) -> Element {
let class = match *store.read() {
Some(_) => "input correct",
None => "input errored",
};
rsx! {
Input{
class,
oninput: move |evt: FormEvent|{
store.set(error_condition.call(evt.value()))
}
}
}
}

````

**Expected behavior**

Input box should have class "input errored" on start. But it has class "input"

**Environment:**

- Dioxus version: 0.7.2
- Rust version: 1.92.0
- OS info: NixOS 25.05
- App platform: Web + Server

**Questionnaire**

I am interested in helping fix this

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.