Comments (10)
I researched a bit and it seems that React as well as SolidJS both have that as part of the core framework. After glancing over the SolidJS implementation however I think there's nothing that requires a deep integration. I kind of want to implement it. I might create a PR in leptos directly
from leptos-use.
Sure. That works too. For reference, there's a working implementation here - https://github.com/jquesada2016/leptos-declarative
(CC @jquesada2016) I don't fully understand how it works, but it has a few bugs and my efforts to contact the maintainer has been in vain. I'm also not sure if or when it will be updated to 0.5.0. If this can be included in core leptos, that'd be amazing.
Perhaps the initial implementation there could be of some help for you?
from leptos-use.
@rakshith-ravi sorry for not being on top of this. I've been very busy trying to find a new job and have not had much time to work on any of my repos. I had intended to pull the <Portal />
component into leptos
directly, but never got around to doing so. I'm sure @gbj would be open to this!
from leptos-use.
No worries :)
Thank you for your contribution to OSS :D
from leptos-use.
My one question here would be whether <Portal/>
requires any deeper integration for server rendering.
Special components like <Suspense/>
and <ErrorBoundary/>
that require messing with the top-down flow are the source of most medium-sized bugs at this point. I imagine <Portal/>
might also be in the "useful but requires some additional framework support" category.
I've never used <Portal/>
in any framework to be clear.
Although now looking at the Solid SSR implementation for Portal
suggests one might just... ignore it for SSR? Lol
export function Portal(props: { mount?: Node; useShadow?: boolean; children: JSX.Element }) {
return "";
}
from leptos-use.
@gbj I would strongly encourage ignoring it for SSR lol
Nevertheless, for SSR it can be done by using a backing <Resource />
that renders at the very end of the SSR render, and then spliced in via an Arc
. Here, the <Resource />
would wait for the end of the render pipeline, which would resolve to the result of the portal.
Does this make any sense at all?
from leptos-use.
Ehh, how the heck did I miss this conversation?
Anyways, @gbj - I think ignoring it for SSR makes sense, considering portals are usually used for rendering things at runtime (think - a tooltip / toast that pops up in the middle of nowhere in the DOM without a proper tree). So having this ignored during SSR should be fine for most users. In case someone specifically needs it rendered on the server, we can always look into more complex implementation as and when people need it
from leptos-use.
Totally agree. I actually started implementing this very similar to how SolidJS does it. But I don't think I'll be able to finish before 0.5.0 is released.
from leptos-use.
I think for 0.5 we can have it as a part of leptos-use and battle test it, and once we have figured out the DX / UX of it we can upstream it for 0.6?
This way we know that whatever goes into upstream would be something we have tried and tested, reducing the possibility of a breaking change upstream.
Thoughts?
from leptos-use.
I think this really should be in leptos proper in any case. Closing this in favor of the PR.
from leptos-use.
Related Issues (20)
- Add `use_event_source` HOT 1
- Getting a signal in a throttle_fn that gets called by a resize observer causes console warnings. HOT 1
- Add url param detection to SSR for `use_color_mode`
- Add binary codec support to `use_websocket`
- Add cookie support to `use_color_mode` HOT 1
- memory access out of bounds when processing large files with `use_drop_zone` HOT 1
- weird behavior of `use_cookie` HOT 4
- Add Spin implementation to `use_cookie`
- Infinite scroll disposed error HOT 2
- use_color_mode resets the value in local storage to auto, when reloading the page HOT 2
- Make `use_color_mode` read headers
- Demo for `use_cookie` in the book is misaligned
- Add `use_web_lock`
- Using `leptos_use` with fermyon spin HOT 2
- Use_clipboard is missing from the docs HOT 2
- reexport `cookie::SameSite` HOT 1
- Support `position:absolute` for `use_draggable_with_options` HOT 1
- `use_local_storage` doesn't work with `Option` or `Vec` HOT 2
- `use_event_source` cannot retrieve error due to `StringCodec::Error` not implementing `Clone`
- use_cookie causes console warnings due to `.get()` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leptos-use.