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

Avoid store state updates if nothing changed #30

Open
remmeier opened this issue Dec 22, 2016 · 7 comments
Open

Avoid store state updates if nothing changed #30

remmeier opened this issue Dec 22, 2016 · 7 comments
Assignees

Comments

@remmeier
Copy link
Collaborator

e.g. POST_STORE_RESOURCE should not update the store if there is no change.

@remmeier remmeier self-assigned this Dec 22, 2016
@remmeier
Copy link
Collaborator Author

I already started working on it and have a couple of updates pending...

remmeier added a commit that referenced this issue Dec 22, 2016
updated POST_STORE_RESOURCE and PATCH_STORE_RESOURCE to detect if no
changes where applied.
@remmeier
Copy link
Collaborator Author

a first update is committed.

something better than Object.assign would be great that those this automatically.

@abdulhaq-e
Copy link
Owner

Do you mean you want to replace all the Object.assign? Lodash has something ready.

@remmeier
Copy link
Collaborator Author

which one do you mean? I was looking for something that works like Object.assign({}, values1, values2) but returns values1 if values2 does not result in any further changes. Kind of a "Object.immutableAssign"

Goal would be to avoid manual equals checks and automatically return the old state if no changes were applied. Naturally it would not be to difficult to implement that manually if it not covered by lodash or something.

@abdulhaq-e
Copy link
Owner

I see what you mean now, no I don't know about the existence of such function. It is good to have it.

@abdulhaq-e
Copy link
Owner

If you want to implement this, you may find useful the new object spread feature in TypeScript 2.1, see https://blog.mariusschulz.com/2016/12/23/typescript-2-1-object-rest-and-spread

@remmeier
Copy link
Collaborator Author

remmeier commented Jan 1, 2017

I have a look if a can come up with something. Will be back at work on tuesday.

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