Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Stabilize the identity of the mutate function #335

Merged
merged 1 commit into from
Mar 22, 2021

Conversation

amacleay-cohere
Copy link
Contributor

Hopefully begins to address #186

Approach:

  • Remove (mutable) references to state. Instead, hook into the
    (immutable) setState function in the mutate function body where
    state references are necessary
  • Try very hard to be honest about what dependencies may change in the
    dependency array, but leave only immutable dependencies that depend only
    on props (almost totally successful)

Why

Hopefully addresses some of #186 , at least with respect to the mutate function.

Hopefully begins to address contiamo#186

Approach:
* Remove (mutable) references to state. Instead, hook into the
  (immutable) `setState` function in the mutate function body where
  state references are necessary
* Try very hard to be honest about what dependencies may change in the
  dependency array, but leave only immutable dependencies that depend only
  on props (almost totally successful)
@netlify
Copy link

netlify bot commented Mar 18, 2021

Deploy request for restful-react accepted.

Accepted with commit 2731e0a

https://app.netlify.com/sites/restful-react/deploys/6052a5c8233f330007496c6e

Copy link

@kfujita-cohere kfujita-cohere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but accidentally selected approve when going to comment so I'm changing to Request changes until you see this

Copy link
Contributor

@fabien0102 fabien0102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just amazing! Thank you!

@fabien0102 fabien0102 merged commit b75d2a6 into contiamo:master Mar 22, 2021
@amacleay-cohere amacleay-cohere deleted the stabilize-use-mutate branch March 22, 2021 19:28
amacleay-cohere added a commit to amacleay-cohere/restful-react that referenced this pull request Apr 16, 2021
Revisiting contiamo#335 in light of the issue noted in contiamo#337

First of all, stabilize the useMutate function even more by using a deep
compare effect. This better handles cases in which the argument to
`useMutate` is an inline object, which is the typical use case.
fabien0102 pushed a commit that referenced this pull request Apr 22, 2021
Revisiting #335 in light of the issue noted in #337

First of all, stabilize the useMutate function even more by using a deep
compare effect. This better handles cases in which the argument to
`useMutate` is an inline object, which is the typical use case.
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.

3 participants