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

Delayed variable not becoming true on form submission (conflict with guide) #538

Open
1 task done
AbdullahAhmadAAK opened this issue Dec 23, 2024 · 3 comments
Open
1 task done

Comments

@AbdullahAhmadAAK
Copy link

AbdullahAhmadAAK commented Dec 23, 2024

  • Before posting an issue, read the FAQ and search the previous issues.

Description
A clear and concise description of what the bug is, and, unless obvious, what you expected instead.

This is the script in a page.svelte file:
pic1

This is the HTML part of the code:
pic2

If I change the argument passed as the loading prop to become $loadingStates.login instead of $delayed && $loadingStates.login the login button will accurately depict the state of the loading button once clicked. I am just not sure why the delayed variable is not changing, despite it being said to change in the tutorial/documentation.

I also logged the value of $delayed to the console during the loading of the event button, and it still shows the delayed to be false.

Any guidance would be appreciated.

@AbdullahAhmadAAK AbdullahAhmadAAK added the bug Something isn't working label Dec 23, 2024
@ciscoheat
Copy link
Owner

There is nothing wrong with $delayed, as you can see from this simple example, so you need to figure out what causes it. Try removing $loadingStates to begin with and see if delayed works as expected at all for you.

@ciscoheat ciscoheat removed the bug Something isn't working label Dec 26, 2024
@AbdullahAhmadAAK
Copy link
Author

AbdullahAhmadAAK commented Jan 2, 2025

I removed $loadingStates and it's still not showing the buttons as loading. Only having the $loadingStates works, but when I add $delayed, it doesn't.

I wrote the below code. It turns out that $delayed always stays false for some reason

$effect: {
    console.log("$delayed: ", $delayed);
  }

doesn't show the code to update to true at any point. I have tried using update() in the afterSubmit function, and also just using use:enhance as well. none of these work @ciscoheat

@ciscoheat
Copy link
Owner

Start from the simple working example, add to it and see when it stops working.

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

2 participants