Replies: 5 comments 7 replies
-
Up-poll might be an option if I understood your problem correctly. You would need to remove it after the first server response. |
Beta Was this translation helpful? Give feedback.
-
I have written a compiler like yours multiple times. My use case is usually some expensive-to-render partial that I don't need right away. I also used your method of using a link that is auto-followed. I like the progressive enhancement aspect of it, i.e. the HTML makes some sense without JavaScript. So thinking about a new attribute like <a up-unfurl id="auth" href="/user">Show user info</a> The link would be followed automatically. Without an explicit <div id="auth">
Hello user!
</div> Maybe it would make sense to have a modifier that delays loading until the link is intersecting the viewport. |
Beta Was this translation helpful? Give feedback.
-
I used |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Lazy-loading fragments ares currently being developed as <a id="menu" href="/menu" up-partial>Load menu</a> Such a link will be followed automatically. It will target itself by default. So the following response would replace the link: <div id="menu">
Long menu here
</div> Multiple partials for the same URL will be merged into a single request with multiple You may also lazy load the partial once it is scrolled into the viewport: <a id="menu" href="/menu" up-partial up-load-on="reveal">Load menu</a> You will also be able to preload links automatically, or when scrolled into view. |
Beta Was this translation helpful? Give feedback.
-
I want to show the authenticated userid in a top corner slot of an otherwise static page. It's quite easy to write plain javascript to listen for the load event and replace a div, but I thought unpoly should be able to handle it, and I'm using it for other stuff anyway. The only solution I could find was this:
with
Where
/user
is an endpoint that returns a<div id="auth">...</div>
. It seems clunky, but it works, and saves me from writing (much) javascript. So is there a more idiomatic unpoly way to do this?Beta Was this translation helpful? Give feedback.
All reactions