DioxusLabs / DioxusLabs/dioxus

Using a folder with asset! doesn't hot reload

Open
#4,518 6 comments 2 reactions 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**
Using a folder with the asset! macro doesn't hot reload when files in the folder change.
E.g.
```
let folder = asset!("path/to/local/folder");
let file = format!("{folder}/file/within/folder.svg");
```
Modifying the folder.svg file requires a triggering a rebuild to see changes.

**Steps To Reproduce**

Steps to reproduce the behavior:
I created a github repo for reproducing it based off of the `dx new` template.
- git clone https://github.com/paul-hansen/dioxus_asset_folder_hotreload_repro.git
- cd dioxus_asset_folder_hotreload_repro
- dx serve (with or without --hotpatch
- edit and save the /assets/svgs/header.svg
- Note that nothing is logged in the dx serve console and the file does not change.

If you change the main.rs to use the /assets/header.svg directly instead of the folder you can see that it does autoreload.

**Expected behavior**

Folders should hot reload their contents. (or document that folders don't work or maybe even prevent using folders if it isn't feasible.)

**Environment:**

- Dioxus version: 0.7.0-alpha.3
- Rust version: 1.88.0
- OS info: EndeavorOS
- App platform:

**Questionnaire**

I don't have time to fix this right now, but maybe later.

Was told this is likely a bug here https://github.com/DioxusLabs/dioxus/discussions/3672#discussioncomment-14039770 so opening this report for tracking.

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.