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

Fix Todo delete button not disabling while waiting for API response #2172

Merged
merged 6 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/wicked-humans-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-svelte": patch
"~TODO~": patch
ignatiusmb marked this conversation as resolved.
Show resolved Hide resolved
---

Disable delete button while waiting for API response
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@
action="/todos/{todo.uid}.json?_method=delete"
method="post"
use:enhance={{
pending: () => todo.pending_delete = true,
ric2b marked this conversation as resolved.
Show resolved Hide resolved
result: () => {
todos = todos.filter((t) => t.uid !== todo.uid);
}
}}
>
<button class="delete" aria-label="Delete todo" />
<button class="delete" aria-label="Delete todo" disabled={!!todo.pending_delete} />
ric2b marked this conversation as resolved.
Show resolved Hide resolved
</form>
</div>
{/each}
Expand Down