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

dx serve output is not entirely clear #2176

Closed
3 tasks
foresterre opened this issue Mar 29, 2024 · 1 comment
Closed
3 tasks

dx serve output is not entirely clear #2176

foresterre opened this issue Mar 29, 2024 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@foresterre
Copy link
Contributor

Problem

Running dx serve after initiating a new app logs a panic during compilation, and the status of the serve command is not clear.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Installed dx with cargo install dioxus-cli (0.5.4 on crates.io)
  2. Created a new Dioxus application
> dx new
✔ 🤷   Which sub-template should be expanded? · Fullstack
🤷   Project Name: releasetool
✔ 🤷   Should the application use the Dioxus router? · true
✔ 🤷   How do you want to create CSS? · Vanilla
  1. run: cd releasetool
  2. run: dx serve

Output in gist (too long for github issue): https://gist.github.com/foresterre/3630ef11472c4fdc1523af2397f73818

Expected behavior

Observed effects:

  • Panic after "Waiting to start building the project..."
    • -> A panic is usually not a good signal

Panic excerpt from log above:

\ ⚙️ Compiling dioxus-fullstack 0.5.0 (git+https://github.com/DioxusLabs/dioxus#44471f4918529fd15a143854984ce3b3d58c07a9\ ⚙️ Compiling releasetool 0.1.0 (path+file:///C:/a/releasetool)
build desktop done
- 💼 Waiting to start building the project...                                                                           Dioxus @ v0.5.4 [03:39:29]

    > Hot Reload Mode: RSX
    > Watching: [ src, assets, Cargo.toml, Dioxus.toml ]
    > Custom index.html: None
    > Serve index.html on 404: True

    > Build Features: [ server ]
    > Build Profile: Debug
    > Build took: 81333 millis

Listening on 127.0.0.1:8080
thread 'main' panicked at C:\Users\a\.cargo\git\checkouts\dioxus-1e619ce595d3799d\44471f4\packages\fullstack\src\serve_config.rs:111:37:
Failed to find index.html. Make sure the index_path is set correctly and the WASM application has been built.: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }
stack backtrace:
  • It seemed like the build hung on the latest step: / ⚙️ Compiling releasetool 0.1.0 (I killed it after 10 minutes), but in hindsight, it might have completed compilation since this is the serve command 😅
    • I expected the status of serve to be clear, so I can act accordingly
    • It wasn't clear immediately whether something still was going on, or whether something had failed, or whether the build was actually completed
      • Whether still going on: The tool shows a long compilation log, not dissimilar to cargo build, but the latest "compiling" step is never shown to have completed. This makes sense with respect to all other "compiling" steps, but since this command (serve) is intended to run forever, it could be useful to also show whether the step was completed, not just made some form of progression
      • Something has failed: in the middle of the compilation log, something panicked, but the build went on: I wasn't sure when the program seemed to hang, whether that was causing it (or whether it actually could continue)
      • Whether the build completed: since this is the serve command, it may very well have succeeded regardless, but only in the middle of the wall of logs you will find this:
- 💼 Waiting to start building the project...                                                                           Dioxus @ v0.5.4 [03:39:29]

    > Hot Reload Mode: RSX
    > Watching: [ src, assets, Cargo.toml, Dioxus.toml ]
    > Custom index.html: None
    > Serve index.html on 404: True

    > Build Features: [ server ]
    > Build Profile: Debug
    > Build took: 81333 millis

Listening on 127.0.0.1:8080
  • Perhaps this should always stay at the top (or bottom) of the window, instead only show the log stream in the lower part of the window

Rerunning dx serve

Rerunning the whole thing
 dx serve
/ ⚙️ Compiling proc-macro2 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling unicode-ident 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling autocfg 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling once_cell 1.19.0 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling version_check 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling pin-project-lite 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling log 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling windows_x86_64_msvc 0.48.5 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling parking_lot_core 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling scopeguard 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling futures-core 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling itoa 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling serde 1.0.197 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling smallvec 1.13.2 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling futures-task 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling futures-io 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling futures-sink 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling memchr 2.7.2 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)
/ ⚙️ Compiling mime_guess 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)
build desktop done
Dioxus @ v0.5.4 [04:05:03]

    > Hot Reload Mode: RSX
    > Watching: [ src, assets, Cargo.toml, Dioxus.toml ]
    > Custom index.html: None
    > Serve index.html on 404: True

    > Build Features: [ server ]
    > Build Profile: Debug
    > Build took: 741 millis

Listening on 127.0.0.1:8080
\ ⚙️ Compiling proc-macro2 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)                               \ ⚙️ Compiling unicode-ident 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)                             \ ⚙️ Compiling cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)                                     \ ⚙️ Compiling once_cell 1.19.0 (registry+https://github.com/rust-lang/crates.io-index)                                 \ ⚙️ Compiling autocfg 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)                                    \ ⚙️ Compiling log 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)                                       \ ⚙️ Compiling serde 1.0.197 (registry+https://github.com/rust-lang/crates.io-index)                                    - ⚙️ Compiling async-trait 0.1.79 (registry+https://github.com/rust-lang/crates.io-index)                               [INFO] dioxus_fullstack::render - Rebuilding vdom
[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "src\\main.rs:22:5:426", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "Router" })], dynamic_attrs: [] }, mount: Cell { value: MountId(0) } } mount=MountId(0)[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "C:\\Users\\a\\.cargo\\git\\checkouts\\dioxus-1e619ce595d3799d\\44471f4\\packages\\router\\src\\components\\router.rs:96:5:37083", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "Outlet" })], dynamic_attrs: [] }, mount: Cell { value: MountId(1) } } mount=MountId(1)
[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "src\\main.rs:6:17:196", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "Home" })], dynamic_attrs: [] }, mount: Cell { value: MountId(2) } } mount=MountId(2)
[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "src\\main.rs:40:5:742", roots: [Dynamic { id: 0 }, Element { tag: "div", namespace: None, attrs: [], children: [Element { tag: "h1", namespace: None, attrs: [], children: [DynamicText { id: 1 }] }, Element { tag: "button", namespace: None, attrs: [Dynamic { id: 0 }], children: [Text { text: "Up high!" }] }, Element { tag: "button", namespace: None, attrs: [Dynamic { id: 1 }], children: [Text { text: "Down low!" }] }, Element { tag: "button", namespace: None, attrs: [Dynamic { id: 2 }], children: [Text { text: "Get Server Data" }] }, Element { tag: "p", namespace: None, attrs: [], children: [DynamicText { id: 2 }] }] }], node_paths: [[0], [1, 0, 0], [1, 4, 0]], attr_paths: [[1, 1], [1, 2], [1, 3]] } }, dynamic_nodes: [Component(VComponent { name: "Link" }), Text(VText { value: "High-Five counter: 0" }), Text(VText { value: "Server data: ..." })], dynamic_attrs: [[Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }], [Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }], [Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }]] }, mount: Cell { value: MountId(3) } } mount=MountId(3)
[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "C:\\Users\\a\\.cargo\\git\\checkouts\\dioxus-1e619ce595d3799d\\44471f4\\packages\\router\\src\\components\\link.rs:282:5:32703", roots: [Element { tag: "a", namespace: None, attrs: [Dynamic { id: 0 }, Dynamic { id: 1 }, Dynamic { id: 2 }, Dynamic { id: 3 }, Dynamic { id: 4 }, Dynamic { id: 5 }, Dynamic { id: 6 }, Dynamic { id: 7 }], children: [Dynamic { id: 0 }] }], node_paths: [[0, 0]], attr_paths: [[0], [0], [0], [0], [0], [0], [0], [0]] } }, dynamic_nodes: [Fragment([VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "src\\main.rs:40:5:842", roots: [Text { text: "Go to blog" }], node_paths: [], attr_paths: [] } }, dynamic_nodes: [], dynamic_attrs: [] }, mount: Cell { value: MountId(18446744073709551615) } }])], dynamic_attrs: [[Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }], [Attribute { name: "href", value: Text("/blog/0"), namespace: None, volatile: false }], [Attribute { name: "onmounted", value: Listener, namespace: None, volatile: false }], [Attribute { name: "dioxus-prevent-default", value: Text("onclick"), namespace: None, volatile: false }], [Attribute { name: "class", value: None, namespace: None, volatile: false }], [Attribute { name: "rel", value: None, namespace: None, volatile: false }], [Attribute { name: "target", value: None, namespace: None, volatile: false }], []] }, mount: Cell { value: MountId(4) } } mount=MountId(4)
[INFO] dioxus_core::diff::node - creating template self=VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "src\\main.rs:40:5:842", roots: [Text { text: "Go to blog" }], node_paths: [], attr_paths: [] } }, dynamic_nodes: [], dynamic_attrs: [] }, mount: Cell { value: MountId(5) } } mount=MountId(5)
[INFO] dioxus_fullstack::render - Suspense resolved
spinning up hot reloading
hot reloading ready
🔥 Hot Reload WebSocket connected
🔮 Finding updates since last compile...
Connected to hot reloading 🚀
finished
Server received: Hello from the server!

screenshots

I've only two screenshots which were both taken after rerunning the dx serve command a few times. They both show the tool output after running dx serve

A:

2024_03_29_WindowsTerminal_986_939_Z2TCA2Sk9y

B:

2024_03_29_WindowsTerminal_1017_914_hPOvs4ozjG

Environment:

  • Dioxus version: 0.5.0
  • Rust version: rustc 1.75.0 (82e1608df 2023-12-21)
  • OS info: Windows 11 x64
  • App platform: fullstack

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@jkelleyrtp
Copy link
Member

The underlying bug is a duplicate of #2090 but the TUI is admittedly not very clear. However, we've totally revamped how do we the CLI and should be better and catching and relaying panics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants