You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using up.reload(":none") should make the request as usual but only update hungry elements for consistency with up-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.
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 dynamicif(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 :)
Activity
[-]Support `up.reload(":none")`[/-][+]Please support `up.reload(":none")`[/+]triskweline commentedon Nov 29, 2023
When reloading Unpoly needs an element to discover which URL to reload from, and which ETags / Last-Modified headers to send.
mordae commentedon Dec 7, 2023
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?
yaroslav-gwit commentedon Jan 17, 2024
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:
I hope this helps, or at least gives you some new ideas :)