Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reloaded assets are not modified #3471

Open
ealmloff opened this issue Dec 30, 2024 · 0 comments
Open

Hot reloaded assets are not modified #3471

ealmloff opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something isn't working cli Related to the dioxus-cli program hot-reload Related to the hot reload crate

Comments

@ealmloff
Copy link
Member

Problem

When assets in the asset! macro are hot reloaded here, they are just copied directly instead of applying any of the options from normal assets. This could cause odd behavior for images that are not resized.

let res = std::fs::copy(&changed_file, asset_dir.join(resource.bundled_path()));

Steps To Reproduce

Steps to reproduce the behavior:

  • Create a dioxus 0.6 project that links to an image that is resized:
use dioxus::prelude::*;

fn main() {
    dioxus::launch(|| {
        let asset = asset!("/assets/66571940.jpeg", ImageAssetOptions::new().with_size(ImageSize::Manual { width: 10, height: 10 }));
        rsx! {
            img {
                src: asset
            }
        }
    });
}
  • Edit the image
  • See the image hot reload to the original size in the live page

Expected behavior

The hot reloaded asset should apply the settings just like the initial asset

Environment:

  • Dioxus version: master
  • Rust version: nightly
  • OS info: MacOS
  • App platform: web
@ealmloff ealmloff added bug Something isn't working cli Related to the dioxus-cli program hot-reload Related to the hot reload crate labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program hot-reload Related to the hot reload crate
Projects
None yet
Development

No branches or pull requests

1 participant