Commit graph

329 commits

Author SHA1 Message Date
Jonathan Kelley
0bd9692e45
Fix cargo test and a number of little cleanup bugs 2024-01-30 17:33:14 -08:00
Jonathan Kelley
8cc17dc1bd
Fix compile 2024-01-29 17:03:50 -08: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
Jonathan Kelley
1847c737e9
Queue effects to run after flush_sync 2024-01-28 02:21:05 -08:00
Jonathan Kelley
974680796f
add test cases, refactor deref 2024-01-26 23:05:40 -08:00
Jonathan Kelley
c0522bc152
cargo check all 2024-01-23 16:58:29 -08:00
Evan Almloff
c51badf07b fix use hooks with impl signals 2024-01-23 10:09:02 -06:00
Jonathan Kelley
028f499bf6
Fix generational box in release mode 2024-01-21 12:46:19 -08:00
Jonathan Kelley
06d9b575b7
rename use_selector to use_memo 2024-01-20 23:32:12 -08:00
Evan Almloff
3dce650367 fix some lints in use on destroy 2024-01-19 12:14:06 -06:00
Evan Almloff
439bc4e9e6 remove computed now that selectors exist 2024-01-19 12:13:55 -06:00
Jonathan Kelley
6ed3aafb2f
Get cargo check --all working 2024-01-18 19:27:55 -08:00
Jonathan Kelley
94b17cc8ca
Fix non tokio builds for desktop 2024-01-18 04:07:28 -08:00
Evan Almloff
e65c5f0eb3 depreciate the render macro 2024-01-16 13:18:46 -06:00
Jonathan Kelley
8559984e9d
and mut bound to mut methods on signals 2024-01-15 23:24:59 -08: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
74aa55f85f
Bring back mroe hooks, remove old hooks, cleanup a number of examples 2024-01-15 17:04:39 -08:00
Jonathan Kelley
b291a5c0b0
Remove a number of hooks 2024-01-15 14:51:34 -08:00
Jonathan Kelley
bb6aa9e792
Add back ondestroy hook 2024-01-15 14:27:20 -08:00
Jonathan Kelley
1dde044697
remove cx.render 2024-01-13 21:12:21 -08:00
Jonathan Kelley
fae0b08e61
Fix the router and stub out a number of crates to get compiling 2024-01-13 20:51:37 -08:00
Evan Almloff
4013341b6c hello world example working 2024-01-05 18:01:05 -06:00
Evan Almloff
3865f44081 make desktop compile 2024-01-05 14:39:45 -06:00
Exotik850
493b0693c5 Put channels back in hook 2023-12-12 13:15:41 -06:00
Exotik850
fdce7bbe5a Return to just TaskId, still polling 2023-12-12 13:02:35 -06:00
kidkool850@gmail.com
69ca1fd8a7 Make cx.spawn() return an Option<TaskId>, returns None if finished immediately 2023-12-11 16:01:40 -06:00
Jonathan Kelley
ad885ec47a
Merge pull request #1650 from ealmloff/effect-cleanup
Add an optional cleanup closure to the use effect hook
2023-12-06 22:13:08 -08:00
Jonathan Kelley
4444ba0b97
Merge pull request #1576 from ealmloff/fix-lints-release-web
Fix use shared state lint in release mode
2023-12-06 21:39:36 -08:00
Exotik850
694989e826
Add use_const hook (#1667)
* Add use_const hook

* cargo fmt

* clippy allow

* pub fn on get_rc
2023-11-28 09:51:09 -06:00
Exotik850
18fa1e4831
Make UseFuture Clone, factor out dependencies field (#1666) 2023-11-27 15:42:48 -06:00
ealmloff
7a459e15d8
Update packages/hooks/src/use_effect.rs
Co-authored-by: Marc Espín <mespinsanz@gmail.com>
2023-11-21 16:28:06 -06:00
Evan Almloff
83f7ef9a44 add an optional cleanup closure to the use effect hook 2023-11-19 09:58:00 -06:00
Evan Almloff
6e85ecea12 fix use shared state lint in release mode 2023-10-25 10:23:23 -05:00
Evan Almloff
9f729dd6de fix clippy 2023-10-14 14:32:08 -05:00
Evan Almloff
3bf6d2d7cf add must use to several hooks 2023-10-14 12:08:54 -05:00
Leonard
2d1234c3d1
Include README and Dioxus logo in package docs (#1536)
* Include README in docs.rs and add Dioxus logo

* Update README.md
2023-10-10 10:52:48 -05:00
Leonard
30a3283438
Add use_on_mount and fix some typos (#1497)
* Add `use_on_mount` and fix some typos

* Optimize away UseOnMount struct

* `use_on_mount`, `use_on_unmount` -> `use_on_create`, `use_on_destroy`

* Make `use_on_unmount` deprecated

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2023-10-04 08:23:21 -05:00
Leonard
a2dd926f7f
Rename modules to use snake_case (#1498) 2023-09-26 17:20:29 -05:00
Calastrophe
98babe1096
partial ord impl (#1473) 2023-09-18 19:50:57 -05:00
Jonathan Kelley
1a093b895e
Merge pull request #1464 from marc2332/fix/update-doc-links-v3-to-v4
fix: Update doc links from v0.3 to v0.4
2023-09-16 11:53:17 -07:00
Jonathan Kelley
f2b05bcfb4
Merge pull request #1440 from ealmloff/fix-use-future-docs
Fix use_future docs
2023-09-16 11:52:54 -07:00
marc2332
7f8c963cd9
fix: Update doc links from v3 to v4 2023-09-16 19:03:27 +02:00
Leonard
c866ae602b
Add system for creating component attributes + new #[component] attribute (#1448)
* Add `#[component]` attribute + system for creating component attributes + other stuff

* Delete inlineprops.rs

* Update inline_props.rs

* Cargo fmt

* Fix clippy warnings and paths in props/mods.rs

* Include where clause in `#[inline_props]` output

* Allow Clippy type complexity in `LinkProps`

* Allow the type complexity lint for the entire link.rs file

* Remove snake_case -> PascalCase converter, but rather enforce PascalCase

Also:
- Put the second function inside the main one instead of besides it.
- Simplify

* Simplify type check lints so they don't return false positives

They will not always work, but they won't return any false positives, like for aliases. This is likely going to be replaced by a more polished Clippy-backed linting system.

* Fix #583

* Cargo fmt

* Add docs for `deserialize()` and remove useless comment

* Add `#[component]` to prelude

* Merge branch 'master' of https://github.com/tigerros/dioxus

* #[inline_props] is no more. Except in the docs folder, but that's going to be removed

* Remove docs folder

* Remove docs from workspace

* Resolve `DeserializerOutput` conversation
2023-09-15 09:13:36 -05:00
Jonathan Kelley
b68a1f57e0
Merge pull request #1436 from ealmloff/tracing 2023-09-13 10:41:23 -07:00
Daniel Albl
18dca07e4b
Use a gen in PartialEq for UseSharedState (#1389)
* Special case UseFutureDep for UseSharedState

* Add 'gen' to UseSharedState for use in 'PartialEq'

* Update 'gen' in 'UseSharedState::new'

* Don't require PartialEq for T in UseSharedState

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2023-09-13 12:10:03 -05:00
Evan Almloff
da627cdf3a fix use_future docs 2023-09-08 09:44:09 -05:00
Evan Almloff
c55c17cb81 switch to tracing for logging 2023-09-06 17:47:33 -05:00
Marc Espín
a0d1e5de3a
fix: Typo on use_on_unmount (#1421) 2023-09-02 17:51:34 -05:00
Daniel Albl
555f4d5834
Add 'with' and 'with_mut' to 'use_shared_state' (#1353) 2023-08-15 13:27:19 -05:00
Evan Almloff
24c626b306 fix clippy 2023-08-08 13:43:57 -07:00
Evan Almloff
4ee4cf23d3 restore a few unneeded breaking changes 2023-08-08 13:37:29 -07:00
Evan Almloff
cfd68bf7d9 document signals crate 2023-08-07 16:56:49 -07:00
Jonathan Kelley
39e89c1fac
Bump crate versions, fix any publish errors 2023-07-31 18:49:54 -07:00
Jonathan Kelley
456b553c93
Merge pull request #1230 from Demonthos/add-computed
Add computed hook
2023-07-31 17:37:47 -07:00
Evan Almloff
d7f7116ce3 clean up the API a bit 2023-07-28 14:17:52 -07:00
Marc Espín
fad3272afb
fix: Update use_coroutine example (#1237) 2023-07-24 11:32:32 -05:00
Miles Murgaw
6210c6fefe
Convert use_eval to use send/recv system (#1080)
* progress: reworked

don't run this, it'll kill your web browser

* feat: use_eval but with comms

* revision: async recv & recv_sync

* revision: use_eval

* revision: standard eval interface

* revision: use serde_json::Value instead of JsValue

* revision: docs

* revision: error message

* create: desktop eval (wip)

* fix: desktop eval

* revision: wrap use_eval in Rc<RefCell<_>>

* fix: fmt, clippy

* fix: desktop tests

* revision: change to channel system

- fixes clippy errors
- fixes playwright tests

* fix: tests

* fix: eval example

* fix: fmt

* fix: tests, desktop stuff

* fix: tests

* feat: drop handler

* fix: tests

* fix: rustfmt

* revision: web promise/callback system

* fix: recv error

* revision: IntoFuture, functionation

* fix: ci

* revision: playwright web

* remove: unescessary code

* remove dioxus-html from public examples

* prototype-patch

* fix web eval

* fix: rustfmt

* fix: CI

* make use_eval more efficient

* implement eval for liveview as well

* fix playwright tests

* fix clippy

* more clippy fixes

* fix clippy

* fix stack overflow

* fix desktop mock

* fix clippy

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2023-07-21 17:36:25 -05:00
Evan Almloff
8af0f0a76a Fix future value never updating 2023-07-21 12:47:51 -07:00
Evan Almloff
bfc8240438 Fix use_future always spawning a new task 2023-07-21 11:52:41 -07:00
Evan Almloff
33ee0636d6 add computed hook 2023-07-20 11:07:55 -07:00
Jonathan Kelley
91d4207fa7
Merge branch 'master' into feature/use-shared-state-better-diagnostics 2023-07-20 10:51:10 -07:00
Andrea Frigido
dccad58f1d Update license field following SPDX 2.1 license expression standard 2023-07-20 18:00:07 +01:00
Jonathan Kelley
c954a116eb
Fix race condition in use_future 2023-07-19 14:23:34 -07:00
Marc Espín
9cbc086aa1
fix: Update use_ref docs (#1201) 2023-07-17 11:02:02 -05:00
Jonathan Kelley
78d383bf1f
Merge pull request #1128 from marc2332/feat/improved-docs
feat(docs): Improved shared state, use_effect and use_memo docs
2023-07-14 15:20:40 -07:00
Jonathan Kelley
9d2b44aa0f
Merge branch 'master' into feature/use-shared-state-better-diagnostics 2023-07-14 15:07:53 -07:00
Jonathan Kelley
2d8841cf70
Add lazy contexts to signals 2023-07-14 12:52:49 -07:00
niedzwiedzw
337697a886 test with forked version of debug-cell 2023-07-13 20:12:28 +02:00
Jonathan Kelley
b25501af48
Merge pull request #1139 from Demonthos/add-onunmount-hook
Add on unmount hook
2023-07-12 14:26:56 -07:00
niedzwiedzw
60d6137f39 better display for locations in panic messages 2023-07-12 16:36:17 +02:00
niedzwiedzw
9154b0f8ea pass the information on previous caller on clone 2023-07-12 16:24:39 +02:00
niedzwiedzw
af091c5bf8 turns out Result combinators are not marked with #[trace_caller], so it must be written without function nesting in order to work 2023-07-12 16:20:19 +02:00
niedzwiedzw
3fa519563e prevent inlining 2023-07-12 12:27:17 +02:00
niedzwiedzw
760d93716f also track previous caller in the in debug mode to show the conflicting borrow 2023-07-12 02:53:48 +02:00
niedzwiedzw
9da32d5465 oh yeah, tracking itself should also be debug-only 2023-07-12 01:53:00 +02:00
niedzwiedzw
b8c14ce35c make location diagnostics optional (only available in debug mode) 2023-07-12 01:38:50 +02:00
niedzwiedzw
43e3304eaf track caller for easier debugging 2023-07-12 01:19:20 +02:00
niedzwiedzw
f159779af4 make thiserror a workspace dependency everywhere else 2023-07-11 22:54:24 +02:00
niedzwiedzw
469a7ac0af better diagnostics for use_shared_state 2023-07-11 21:41:52 +02:00
Marc Espín
32d4472bfd
fix: Remove duplicated doc links and improved some descriptions (#1167) 2023-07-08 11:04:27 -05:00
traxys
f2c1c05792 Add a helper macro for properties & async
The to_owned macro is helpful to handle hooks with async components, but
when using properties it can be problematic because `cx` will be moved
in the async block, and will result in a compilation error. This adds a
new helper that allows to make either hooks or properties owned.
2023-07-06 15:18:19 +02:00
ealmloff
d1cd4851aa
Merge branch 'DioxusLabs:master' into add-onunmount-hook 2023-07-03 12:09:13 -07:00
marc2332
052ae145bf
updated docs 2023-07-02 23:00:26 +02:00
Evan Almloff
a6e87cf340 fix tests 2023-06-30 12:56:22 -07:00
Jon Kelley
3985bd664b
Merge pull request #1084 from marc2332/patch-6
fix: Properly drop UseFuture's values to avoid leaking memory
2023-06-30 12:12:09 -07:00
Evan Almloff
60b25e9c2f add on unmount hook 2023-06-30 08:54:08 -07:00
Marc Espín
f4e1d78d7a
fix(docs): Fix dioxus-hooks crate description (#1134) 2023-06-29 10:27:54 -05:00
marc2332
8a2f9f3fcb
feat(docs): Improved shared state, use_effect and use_memo docs 2023-06-28 00:15:00 +02:00
Jon Kelley
dfa4d8d989
Merge pull request #1105 from Demonthos/workspace-dependancies
Workspace Dependancies
2023-06-27 10:17:12 -07:00
Marc Espín
a3654fd0b8
Update use_shared_state.rs 2023-06-20 19:13:34 +02:00
Evan Almloff
5f873511c5 use workspace dependancies 2023-06-19 14:29:11 -05:00
Marc Espín
1546fce485
fix: Properly drop UseFuture's values to avoid leaking memory 2023-06-10 18:26:02 +02:00
Jonathan Kelley
c97f43146d bump hooks and web crates 2023-05-18 13:42:15 +02:00
Miles Murgaw
06233ac550 fix: rustfmt 2023-05-13 12:41:00 -04:00
Miles Murgaw
d059b2bc05 doc: mention futures-util in use_coroutine hook 2023-05-13 11:50:24 -04:00
Evan Almloff
2dd40ec202 add docs to remaining items 2023-03-02 12:02:12 -06:00
Evan Almloff
88198fc47c remove static bound on owner 2023-03-02 11:59:25 -06:00