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

isUpdating can go negative #124

Closed
rkrisztian opened this issue Feb 13, 2017 · 2 comments
Closed

isUpdating can go negative #124

rkrisztian opened this issue Feb 13, 2017 · 2 comments

Comments

@rkrisztian
Copy link
Contributor

rkrisztian commented Feb 13, 2017

I have a form that lets the user edit an entity and save the changes in the end, and implemented it like this:

onEntityFieldChange(event: FieldChangeEvent) {
	this.ngrxJsonApiService.patchResource({
		resource: Object.assign({}, event.entity, {attributes: {someField: event.newValue}}),
		toRemote: false
	});
}

saveEntity(entity: StoreResource) {
	this.ngrxJsonApiService.patchResource({resource: entity, toRemote: true});
}

My problem is, when I click on Save:

  • on API_UPDATE_INIT, isUpdating does not change.
  • on API_UPDATE_SUCCESS, isUpdating goes from 0 to -1.

Am I possibly using the service incorrectly? (Please note: documentation is missing in that department.)

I need this working because I need a way to check whether the application is loading, and I'm checking fields like isUpdating to achieve that.

@abdulhaq-e
Copy link
Owner

Hello @rkrisztian

Thanks for using this library and for reporting this bug. You are using the service correctly, it's a bug that I have (hopefully) dealt with this properly in PR #126. Sorry for the lack of documentation, this will be fixed soon.

Thanks again.

@abdulhaq-e
Copy link
Owner

Fixed in release 1.1

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