Skip to content
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

[feat] Add .once modifier #103

Open
justisr opened this issue Oct 18, 2024 · 0 comments
Open

[feat] Add .once modifier #103

justisr opened this issue Oct 18, 2024 · 0 comments

Comments

@justisr
Copy link
Contributor

justisr commented Oct 18, 2024

Sorry for the multiple issues in one go, but I figured this should go in its own one.

This seems very relevant to the caching system you're currently working on: #65

There are times when you only want to request a page's contents once, rather than every time the user clicks the button. For instance, your dialog/modal example https://alpine-ajax.js.org/examples/dialog/ every time a user clicks "Finn" another Ajax request is sent:

ab87306db0e108bec2e8a5c77e83a157.mp4

Ideally, I'd want to be able to keep the already downloaded modal and simply re-open it if the user clicks it again. This is particularly useful in cases where what's been downloaded is a form, and you want the user to be able to re-open it and continue filling in whatever they were working on, rather than downloading a new copy and erasing the previous contents.

Figured now would be a good time to suggest this since you're already working on a caching system.
The .once suggestion is purely based on Alpine's existing .once modifier for event listeners btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@justisr and others