Commit graph

1224 commits

Author SHA1 Message Date
Jonathan Kelley
ae352f8958
Feat: reject invalid keys 2024-03-07 16:03:00 -08:00
Evan Almloff
3d7f419636 fix memos during suspense 2024-03-07 11:49:51 -06:00
Evan Almloff
c9603ea984 only poll suspended futures 2024-03-05 18:24:01 -06:00
Evan Almloff
287416cfa7 rename flush_sync to wait_for_next_render 2024-03-04 19:52:17 -06:00
Evan Almloff
2e3a730ed5 fix clippy 2024-03-04 16:10:04 -06:00
Evan Almloff
3827378f68 Merge branch 'main' into fix-effect 2024-03-04 15:40:37 -06:00
Evan Almloff
b42992bad1 add more internal documentation about tasks 2024-03-04 15:38:28 -06:00
Evan Almloff
fc7efd8006 test child future drop behavior 2024-03-04 15:26:16 -06:00
Evan Almloff
797feb5657 remove logging, clean up some code, and fix effect test 2024-03-04 15:09:31 -06:00
Evan Almloff
c4b8ebc1cf separate task and scope tasks 2024-03-04 13:04:22 -06:00
Evan Almloff
78b9b157dc fix formatting 2024-03-04 12:04:09 -06:00
Evan Almloff
a14e5be7ad Fix effect ordering after reruns 2024-03-01 12:46:07 -06:00
Evan Almloff
26f5fb80cb clean up the task queue 2024-03-01 12:18:42 -06:00
Jeremy Arnold
9ae3d14e67
Add tracing to virtual_dom (#1949)
Address #1161; Add tracing to virtual dom:

- Added a dependency on [tracing-fluent-assertions](https://github.com/tobz/tracing-fluent-assertions) for test cases
- Added a test case showing tracing


example log
```
2024-02-28T21:52:25.266474Z TRACE dioxus_core::scope_context: providing context alloc::rc::Rc<dioxus_core::error_boundary::ErrorBoundary> (TypeId { t: 86211292795840746005296084033382154959 }) in app
    at packages/core/src/scope_context.rs:189
    in dioxus_core::virtual_dom::VirtualDom::new

  2024-02-28T21:52:25.266651Z TRACE dioxus_core::scope_context: looking for context generational_box::Owner<generational_box::sync::SyncStorage> (TypeId { t: 16187079142358387300491255137481079601 }) in app
    at packages/core/src/scope_context.rs:106
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266662Z TRACE dioxus_core::scope_context: context generational_box::Owner<generational_box::sync::SyncStorage> (TypeId { t: 16187079142358387300491255137481079601 }) not found
    at packages/core/src/scope_context.rs:140
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266671Z TRACE dioxus_core::scope_context: providing context generational_box::Owner<generational_box::sync::SyncStorage> (TypeId { t: 16187079142358387300491255137481079601 }) in app
    at packages/core/src/scope_context.rs:189
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266713Z TRACE dioxus_core::scope_context: providing context dioxus_signals::reactive_context::ReactiveContext (TypeId { t: 86476382904980360086558195405008306005 }) in app
    at packages/core/src/scope_context.rs:189
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266723Z TRACE dioxus_core::scope_context: looking for context generational_box::Owner (TypeId { t: 87785542931436862771411509553978749471 }) in app
    at packages/core/src/scope_context.rs:106
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266730Z TRACE dioxus_core::scope_context: context generational_box::Owner (TypeId { t: 87785542931436862771411509553978749471 }) not found
    at packages/core/src/scope_context.rs:140
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266769Z TRACE dioxus_core::scope_context: providing context generational_box::Owner (TypeId { t: 87785542931436862771411509553978749471 }) in app
    at packages/core/src/scope_context.rs:189
    in dioxus_core::scope_arena::render with scope: app
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266828Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:60:5:1728", roots: [Element { tag: "div", namespace: None, attrs: [], children: [Element { tag: "button", namespace: None, attrs: [Dynamic { id: 0 }], children: [Text { text: "+" }] }, Element { tag: "button", namespace: None, attrs: [Dynamic { id: 1 }], children: [Text { text: "-" }] }, Element { tag: "ul", namespace: None, attrs: [], children: [Dynamic { id: 0 }] }] }], node_paths: [[0, 2, 0]], attr_paths: [[0, 0], [0, 1]] } }, dynamic_nodes: [Placeholder(VPlaceholder)], dynamic_attrs: [[Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }], [Attribute { name: "onclick", value: Listener, namespace: None, volatile: false }]] }, mount: Cell { value: MountId(0) } }, mount: MountId(0)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::rebuild

  2024-02-28T21:52:25.266896Z TRACE dioxus_core::virtual_dom: Calling 1 listeners
    at packages/core/src/virtual_dom.rs:695
    in dioxus_core::virtual_dom::VirtualDom::handle_bubbling_event with parent: Some(ElementRef { path: ElementPath { path: [0, 0] }, mount: MountId(0) }), name: "click"
    in dioxus_core::virtual_dom::VirtualDom::handle_event with name: "click", data: Any { .. }, element: ElementId(2), bubbles: true

  2024-02-28T21:52:25.266934Z TRACE dioxus_core::virtual_dom: Marking scope ScopeId(0) (app) as dirty
    at packages/core/src/virtual_dom.rs:379
    in dioxus_core::virtual_dom::VirtualDom::process_events

  2024-02-28T21:52:25.266997Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:71:37:2059", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "ChildExample" })], dynamic_attrs: [] }, mount: Cell { value: MountId(1) } }, mount: MountId(1)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate

  2024-02-28T21:52:25.267026Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:81:5:2238", roots: [Element { tag: "li", namespace: None, attrs: [Dynamic { id: 0 }], children: [DynamicText { id: 0 }] }], node_paths: [[0, 0]], attr_paths: [[0]] } }, dynamic_nodes: [Text(VText { value: "0" })], dynamic_attrs: [[Attribute { name: "onmouseover", value: Listener, namespace: None, volatile: false }]] }, mount: Cell { value: MountId(2) } }, mount: MountId(2)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate

  2024-02-28T21:52:25.267061Z TRACE dioxus_core::virtual_dom: Calling 1 listeners
    at packages/core/src/virtual_dom.rs:695
    in dioxus_core::virtual_dom::VirtualDom::handle_bubbling_event with parent: Some(ElementRef { path: ElementPath { path: [0, 0] }, mount: MountId(0) }), name: "click"
    in dioxus_core::virtual_dom::VirtualDom::handle_event with name: "click", data: Any { .. }, element: ElementId(2), bubbles: true

  2024-02-28T21:52:25.267084Z TRACE dioxus_core::virtual_dom: Marking scope ScopeId(0) (app) as dirty
    at packages/core/src/virtual_dom.rs:379
    in dioxus_core::virtual_dom::VirtualDom::process_events

  2024-02-28T21:52:25.267131Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:71:37:2059", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "ChildExample" })], dynamic_attrs: [] }, mount: Cell { value: MountId(3) } }, mount: MountId(3)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate

  2024-02-28T21:52:25.267157Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:81:5:2238", roots: [Element { tag: "li", namespace: None, attrs: [Dynamic { id: 0 }], children: [DynamicText { id: 0 }] }], node_paths: [[0, 0]], attr_paths: [[0]] } }, dynamic_nodes: [Text(VText { value: "1" })], dynamic_attrs: [[Attribute { name: "onmouseover", value: Listener, namespace: None, volatile: false }]] }, mount: Cell { value: MountId(4) } }, mount: MountId(4)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate

  2024-02-28T21:52:25.267206Z TRACE dioxus_core::virtual_dom: Calling 1 listeners
    at packages/core/src/virtual_dom.rs:695
    in dioxus_core::virtual_dom::VirtualDom::handle_bubbling_event with parent: Some(ElementRef { path: ElementPath { path: [0, 0] }, mount: MountId(0) }), name: "click"
    in dioxus_core::virtual_dom::VirtualDom::handle_event with name: "click", data: Any { .. }, element: ElementId(2), bubbles: true

  2024-02-28T21:52:25.267229Z TRACE dioxus_core::virtual_dom: Marking scope ScopeId(0) (app) as dirty
    at packages/core/src/virtual_dom.rs:379
    in dioxus_core::virtual_dom::VirtualDom::process_events

  2024-02-28T21:52:25.267274Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:71:37:2059", roots: [Dynamic { id: 0 }], node_paths: [[0]], attr_paths: [] } }, dynamic_nodes: [Component(VComponent { name: "ChildExample" })], dynamic_attrs: [] }, mount: Cell { value: MountId(5) } }, mount: MountId(5)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate

  2024-02-28T21:52:25.267297Z  INFO dioxus_core::diff::node: creating template, self: VNode { vnode: VNodeInner { key: None, template: Cell { value: Template { name: "packages/core/tests/tracing.rs:81:5:2238", roots: [Element { tag: "li", namespace: None, attrs: [Dynamic { id: 0 }], children: [DynamicText { id: 0 }] }], node_paths: [[0, 0]], attr_paths: [[0]] } }, dynamic_nodes: [Text(VText { value: "2" })], dynamic_attrs: [[Attribute { name: "onmouseover", value: Listener, namespace: None, volatile: false }]] }, mount: Cell { value: MountId(6) } }, mount: MountId(6)
    at packages/core/src/diff/node.rs:547
    in dioxus_core::virtual_dom::VirtualDom::render_immediate
```
2024-02-29 17:49:35 -06:00
Jonathan Kelley
d61c3fab20
Merge branch 'main' into debug-subscriptions 2024-02-29 12:30:27 -08:00
Evan Almloff
c7ffdc7b29 rerun tasks in the same order as components 2024-02-29 11:43:07 -06:00
Evan Almloff
277e4677e9 fix clippy 2024-02-26 11:49:05 -06:00
Evan Almloff
f539698963 add debug information for signal subscriptions 2024-02-26 11:46:01 -06:00
Jonathan Kelley
e0b0afc0a9
remove unsafe from tests in core 2024-02-22 17:46:51 -08:00
Evan Almloff
48751d2f98 only subscribe scopes to signals when rendering 2024-02-14 09:33:22 -06:00
Evan Almloff
476b2ac88a fix client side suspense 2024-02-12 08:56:27 -06:00
Evan Almloff
162b033c36 provide feature hints for the dioxus crate as well 2024-02-09 12:23:57 -06:00
Evan Almloff
c431429448 fix web playwright tests 2024-02-05 15:25:51 -06:00
Jonathan Kelley
7e54039ed2
fix make tests 2024-02-05 12:24:59 -08:00
Evan Almloff
356497df4e fix some clippy lints 2024-02-05 08:17:25 -06:00
Jonathan Kelley
4a7fe938ad
Make clippy happy 2024-02-04 23:03:52 -08:00
Jonathan Kelley
3295935de7
Fix panic on pausing dead tasks 2024-02-02 14:33:02 -08:00
Jonathan Kelley
f44b72f5e1
server_future uses use_resource 2024-02-02 14:08:21 -08:00
Jonathan Kelley
0fd7799bc2
disable use_future on the server 2024-02-02 13:36:19 -08:00
Jonathan Kelley
8f70a84c70
Use futures_util mutex instead of flume for sending flush lock wakeups 2024-02-02 13:09:26 -08:00
Jonathan Kelley
7c2947a131
Implement effects using reactivecontext 2024-02-01 13:21:52 -08:00
Jonathan Kelley
968f24a7b3
wip: reactive context instead of effect 2024-02-01 13:21:52 -08:00
Jonathan Kelley
0c71b95e82
skeleton of use_server_future with reactivity 2024-02-01 13:21:52 -08:00
Jonathan Kelley
8f07d881a6
Switch todo!() to unreachable!/unimplemented! where it matters 2024-01-31 16:26:20 -08:00
Jonathan Kelley
a14789eebc
rename inner on event to data 2024-01-31 16:26:19 -08:00
Jonathan Kelley
09e14f1936
Implement some clippy fixes 2024-01-30 18:17:45 -08:00
Jonathan Kelley
0bd9692e45
Fix cargo test and a number of little cleanup bugs 2024-01-30 17:33:14 -08:00
Jonathan Kelley
eff1dd6c90
Merge branch 'master' into breaking 2024-01-30 16:20:19 -08:00
Evan Almloff
aa03a6316a remove Rc from the Component type alias 2024-01-30 12:29:47 -06:00
Jonathan Kelley
cef64d43df
move hooks out of signals crate 2024-01-29 17:02:26 -08:00
Jonathan Kelley
dcdada542b
Properly implement wait_for_suspense
Wait_for_suspense now does not call flush_sync, making it
appropriate for deferring effects on the server. Futures will
still run on the server (as needed to progress suspense)
but use_effect / and memo watchers will not run on the server
2024-01-29 14:12:05 -08:00
Evan Almloff
50e3216d8b convert T into signals automatically 2024-01-29 13:36:39 -06:00
Jonathan Kelley
1847c737e9
Queue effects to run after flush_sync 2024-01-28 02:21:05 -08:00
Jonathan Kelley
7e4a1e9c7c
Move methods 2024-01-28 01:30:59 -08:00
Jonathan Kelley
7b0dcb3206
Add flush_sync and pre_render methods to core 2024-01-28 01:30:33 -08:00
Evan Almloff
c3edf99b63 make anyprops and vprops private again 2024-01-25 09:32:36 -06:00
Evan Almloff
458c13fb74 run effects in the scope they were created in 2024-01-24 18:34:22 -06:00
Evan Almloff
c3555a7ec0 fix Option<String> in props 2024-01-24 16:40:14 -06:00
Jonathan Kelley
c0522bc152
cargo check all 2024-01-23 16:58:29 -08:00
Evan Almloff
c172914b21 drop scopes in order when dropping the virtual dom 2024-01-23 11:40:45 -06:00
Evan Almloff
50873bf9c7 fix component swap test 2024-01-22 09:39:31 -06:00
Evan Almloff
cdf25f0c14 run hook destructors inside of the scope they were created in 2024-01-22 09:32:53 -06:00
Evan Almloff
e5a11aa2a5 fix drop order test 2024-01-22 09:13:05 -06:00
Evan Almloff
8f786d85cd drop hooks before contexts 2024-01-22 09:08:29 -06:00
Ege Gungordu
43fe17d9c5 fix attribute diffs causing infinite loops with test 2024-01-22 01:19:37 +03:00
Ege Gungordu
6111bdfdf0 add attribute diff test 2024-01-21 18:29:29 +03:00
Ege Gungordu
7aa3f21954 fix attribute diff infinite loop (#1843) 2024-01-21 18:26:48 +03:00
Jonathan Kelley
fc0b0f02a1
downcast data with panic 2024-01-20 11:21:49 -08:00
Jonathan Kelley
728a26a2cc
Fix borrowmut error in nested spawns 2024-01-19 22:01:21 -08:00
Evan Almloff
b53ba7b5c7 fix replacing fragments 2024-01-19 19:23:01 -06:00
Evan Almloff
bc914deeaa create Signal::global 2024-01-19 13:46:17 -06:00
Jonathan Kelley
6ed3aafb2f
Get cargo check --all working 2024-01-18 19:27:55 -08:00
Jonathan Kelley
d8af9b7ed1
Fix compile checks on numerous packages using --all --all-features 2024-01-18 16:27:43 -08:00
Jonathan Kelley
127709f83f
Tiny aesthetic tweaks 2024-01-18 10:59:43 -08:00
Evan Almloff
25ad3da659 remove some generics from LaunchBuilder 2024-01-17 20:15:16 -06:00
Evan Almloff
ae3e167cfe make fullstack hello world compile 2024-01-17 16:58:03 -06:00
Evan Almloff
499e81fa82 fix fullstack send bound 2024-01-17 15:46:29 -06:00
Evan Almloff
dab87c0144 try not double boxing 2024-01-17 15:07:45 -06:00
Evan Almloff
d28221bdc2 unqueue tasks when a scope is dropped 2024-01-17 08:36:39 -06:00
Evan Almloff
701093ede5 Try to rerun all dirty scopes before polling any tasks to fix effect ordering 2024-01-17 08:17:30 -06:00
Jonathan Kelley
47e46de74f
remove subtree file 2024-01-16 18:08:22 -08:00
Jonathan Kelley
c3d810bcd0
Little bit more cleanup in core 2024-01-16 18:07:29 -08:00
Jonathan Kelley
66ba220265
Remove smallbox 2024-01-16 17:54:13 -08:00
Jonathan Kelley
9d0d5d74f6
Remove last bit of unsafe 2024-01-16 17:52:59 -08:00
Jonathan Kelley
3008870818
Cleanup runtime code 2024-01-16 17:38:39 -08:00
Jonathan Kelley
8b9bf57c03
Cleanup core more 2024-01-16 17:23:34 -08:00
Jonathan Kelley
374c7d0cd8
Cleanup more of core 2024-01-16 17:14:19 -08:00
Jonathan Kelley
9f595171ce
Remove boxedanyprops abstraction 2024-01-16 16:09:59 -08:00
Jonathan Kelley
fb4f97406c
Fix router codegen 2024-01-16 15:48:37 -08:00
Jonathan Kelley
3fb7c359c2
Rename to component function 2024-01-16 15:09:44 -08:00
Jonathan Kelley
c94af9538b
Remove phantom markers and just default to Rc<dyn Fn(props) -> Element> where it makes sense 2024-01-16 15:07:22 -08:00
Evan Almloff
5ca0c9cbf8 fix light diffing components 2024-01-16 16:21:17 -06:00
Evan Almloff
c4d6f19b38 remove logs 2024-01-16 16:17:52 -06:00
Evan Almloff
ad01a45f3b restore core tests 2024-01-16 15:51:02 -06:00
Evan Almloff
b58eb04278 Fix basic routers 2024-01-16 14:39:48 -06:00
Evan Almloff
e65c5f0eb3 depreciate the render macro 2024-01-16 13:18:46 -06:00
Evan Almloff
7e4d2debe0 implement launch builder for the desktop and web platforms 2024-01-16 08:42:16 -06:00
Evan Almloff
ef553a2cb2 unbox component functions 2024-01-16 07:48:32 -06:00
Jonathan Kelley
bb750f5336
Fix effect stack issue 2024-01-15 20:45:59 -08:00
Jonathan Kelley
a32ae8b112
Remove push_future, get use_future kinda working again 2024-01-15 19:34:04 -08:00
Jonathan Kelley
14651a3573
Change context api to panic with nice error message 2024-01-15 18:02:58 -08:00
Jonathan Kelley
ee5020c41f
actually set task 2024-01-15 17:37:50 -08:00
Jonathan Kelley
1332b82dc8
Expose current task 2024-01-15 17:32:49 -08:00
Evan Almloff
af1749d7be re export renderers in dioxus 2024-01-15 19:14:11 -06:00
Jonathan Kelley
bb6aa9e792
Add back ondestroy hook 2024-01-15 14:27:20 -08:00
Jonathan Kelley
6134a2ce24
Clean up a number of examples 2024-01-15 13:06:05 -08:00
Evan Almloff
940108f242 fix hydration 2024-01-15 13:23:35 -06:00
Evan Almloff
16d5d00bdf fix ssr tests 2024-01-15 11:12:24 -06:00
Evan Almloff
b039d6acc0 fix remaining core tests 2024-01-15 11:06:27 -06:00
Evan Almloff
51441b44ca fix diffing fuzz test 2024-01-15 10:52:30 -06:00