Replaces the given element with a fresh copy fetched from the server.
By default, reloading is not considered a user navigation and e.g. will not update
the browser location. You may change this with { navigate: true }
.
let { fragment } = await up.reload('.inbox')
console.log("New .inbox element: ", fragment)
Unpoly remembers the URL from which a fragment was loaded, so you don't usually need to pass a URL when reloading.
To reload from another URL, pass a { url }
option or set an [up-source]
attribute
on the element being reloaded or its ancestors.
Your server-side app is not required to re-render a request if there are no changes to the cached content.
By supporting conditional HTTP requests you can quickly produce an empty response for unchanged content.
The element that should be reloaded.
If omitted, an element matching a selector in up.fragment.config.mainTargets
will be reloaded.
When an Element
object is passed, a target selector will be derived.
See options for up.render()
.
The URL from which to reload the fragment. This defaults to the URL from which the fragment was originally loaded.
Overrides properties from the new fragment's [up-data]
with the given data object.
Preserve the reloaded fragment's data object.
Properties from the new fragment's [up-data]
are overridden with the old fragment's [up-data]
.
Whether the reloading constitutes a user navigation.
A promise that fulfills with an up.RenderResult
once the fragment
has been reloaded and rendered.