-
Notifications
You must be signed in to change notification settings - Fork 69
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
Please support up.reload(":none")
#563
Comments
When reloading Unpoly needs an element to discover which URL to reload from, and which ETags / Last-Modified headers to send. |
Ah, I see. Would it be possible to support the behavior described above as an option then? For example by making it possible to pass update targets that further restrict what children of the target element are actually replaced? |
I worked around a similar issue another way. I've created a JS function that was listening for a particular event (path change in my case, but it can be anything really), and once the event was triggered a block of code below had to update few elements (at once) on the page: // vmName variable was set above this block, to make an element that has to be updated more dynamic
if (document.location.pathname.includes('/hosts/')) {
up.render(`#vmActionButtons, .unpoly-snapshot-list`, { url: document.location.pathname });
} else {
up.render(`#vmActionButtons, #sidebarVm${vmName}, .unpoly-snapshot-list`, { url: document.location.pathname });
} I hope this helps, or at least gives you some new ideas :) |
Using
up.reload(":none")
should make the request as usual but only update hungry elements for consistency withup-target=":none"
. It currently crashes, unable to find an actual":none"
inside the fragment.As for when this is needed, upon clicking the cart icon, an interactive cart drawer opens. Once user finishes editing the quantities and possibly remove some products from the cart, they dismiss the drawer. Upon dismiss,
on-dismiss
reloads the parent layer to reflect changes the user made. Since the page also contains other interactive widgets that need to retain their state, it is undesirable to perform a full reload. Refreshing just the hungry elements suffices.I have worked around the issue by reloading the button itself instead, but that makes the intent pretty non-obvious.
The text was updated successfully, but these errors were encountered: