-
Notifications
You must be signed in to change notification settings - Fork 120
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
xilem_web: Is it possible for a update function to return two dom nodes without a parent contianer? #461
Comments
Hmm yeah thinking about it, it would make sense to be able to add a "fragment" (aka I'm also wondering, whether we should support elements such as |
Supporting |
We should be able to have a This is similar to how the planned root for It would probably also be possible to have a |
I don't think it really adds complexity (at least less than allowing a
Funny I started writing something yesterday suggesting something similar, but forgot to press send (possibly because it was way too late)^^ I guess that would mean a |
) Should fix #461. This allows a `ViewSequence` (called `DomFragment`) of `DomView`s as root component. The `counter` example is updated to show this new behavior.
I ran into a small issue with this. I can now return multiple nodes, which is great: fn foo(state: &mut State) -> impl DomFragment<State> {
use html::*;
(div(()), div(()))
} However, I cannot do so from within a call to fn bar(state: &mut State) -> impl DomFragment<State> {
use html::*;
fork(
(div(()), div(())),
memoized_await((), |()| async {}, |state: &mut State, _| {}),
)
} I get the following error:
|
|
Yup, that does work, although it's a little weird for my use case, since I want |
Yeah I see, intuitively it would make sense, but I think it's not easily possible to do this with the same function. We already have to fight for ambiguity quite a lot (e.g. We could add |
Possibly more useful would be a single-argument function which could be used to host any number of
I think that probably, the ideal state would be if users could just stick things like |
#608 should make this possible. |
I have an app I'm rewriting using
xilem_web
whose HTML was formerly:With
xilem_web
, I'm doing:Which results in an extra wrapper div:
I tried:
As well as fooling around with
xilem_core::ViewSequence
, to no avail. Is it possible to avoid the extra wrapper div? It's not a huge deal, but an extra wrapper div does sometimes make CSS more complex (body > div > nav
instead ofbody > nav
) and is an extra div to manually expand when inspecting the DOM.The text was updated successfully, but these errors were encountered: