Skip to content

WIP: Result reducers #766

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

Merged
merged 14 commits into from
Oct 14, 2016
Merged

WIP: Result reducers #766

merged 14 commits into from
Oct 14, 2016

Conversation

helfer
Copy link
Contributor

@helfer helfer commented Oct 13, 2016

TODO:

  • call during MUTATION_RESULT
  • action contains operationName
  • call during MUTATION_INIT with optimistic result
  • call during QUERY_RESULT
  • call during SUBSCRIPTION_RESULT (-> no such action. Fix when working out subscription API)
  • write tests for all of the above
  • add a test that calls multiple query reducers.
  • If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass
  • Update CHANGELOG.md with your change
  • Add your name and email to the AUTHORS file (optional)
  • If this was a change that affects the external API, update the docs and post a link to the PR in the discussion

Things to note:

  1. The reducer will run on every result, including the result of its own query.
  2. The reducer (right now) does not run on subscription results (pending subscription API change), and it does not run on query results that didn't hit the server (i.e. QUERY_RESULT_CLIENT). It also doesn't run when errors are returned. We may need to update this in the future.
  3. Reducers run serially. A reducer gets the store with modifications from previous reducers already applied.
  4. Reducers run after writing the result to store, and after result behaviors.

This feature could use a few more tests to make sure the interactions with other features (eg. optimistic updates) is solid.

@helfer helfer changed the title Result reducers WIP: Result reducers Oct 13, 2016
@helfer
Copy link
Contributor Author

helfer commented Oct 14, 2016

@stubailo can you give this a quick look?

@helfer
Copy link
Contributor Author

helfer commented Oct 14, 2016

I'm going to merge this now, we can make changes later if necessary.

@helfer helfer merged commit 21dab99 into master Oct 14, 2016
@stubailo stubailo deleted the result-reducers branch October 15, 2016 22:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant