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

Loading state is set to false unexpectedly. #1054

Open
FunnyGhost opened this issue Feb 6, 2023 · 1 comment
Open

Loading state is set to false unexpectedly. #1054

FunnyGhost opened this issue Feb 6, 2023 · 1 comment

Comments

@FunnyGhost
Copy link

Is this a regression?

No

Description

In an application, I want to set the loading state to true, do some operations, some store updates, wait for some network requests, and after all is done, set loading to false. However, the moment I do a regular update to the store, the loading state is set back to false, even though I did not set it.

In the provided example, you can see that I only use setLoading(false) in the constructor of the service.
In the TodosService on line 32, I set loading to true, but never set it to false. However, in the UI(and in the console log) you can see that the loading state is set to false somehow.
If I move the delay(2000) on line 32, you'll see that the loading state is set to false after 2 seconds. This coincides with the store update(even though I'm not specifically telling it to update the loading state).

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/akita-todos-app-3behcu?file=src/app/todos/state/todos.service.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

@Den-dp
Copy link
Contributor

Den-dp commented Mar 11, 2023

You can try

tap((todo) => this.todosStore.add(todo, { loading: true })),

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