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

new API with useMutableSource #48

Merged
merged 28 commits into from Dec 18, 2020
Merged

Conversation

dai-shi
Copy link
Owner

@dai-shi dai-shi commented Mar 12, 2020

API is not based on Context. It's optional.

Check list:

  • implementation
  • readme

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 12, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 16, 2020

README.md Outdated Show resolved Hide resolved
dai-shi and others added 4 commits Mar 16, 2020
@faceyspacey
Copy link

faceyspacey commented Mar 19, 2020

I implemented it as documented with the react-redux Context recipe, and it works (useTrackedState), but I get this error in the console after state changes:

index.js?4ca0:22 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in TradeRow (created by TradeList)
    in div (created by TradeList)
    in div (created by Component)
    in Component (created by TradeList)
    in TradeList (created by Switcher)

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 19, 2020

@faceyspacey Hmm, is it possible for you to make a small reproduction in codesandbox?
Maybe from this working version? https://codesandbox.io/s/magical-mahavira-p22qv (or another simpler example?)

@faceyspacey
Copy link

faceyspacey commented Mar 19, 2020

I will at some point, but I'm using a custom setup with a babel plugin that makes MyComponent = (props, state, actions) => ... possible. state here FYI contains both reducers and selectors.

I've been meaning to show you how I'm doing it by making a small repro of this aspect of the system, so we can figure out how to memoize selectors across usages, as selectors in Respond are defined once upfront (not in component functions). I'll make the repro when I get to this point.

If it's not occurring for you, it's likely due to my system. I have an idea of what would be causing. I'll make my system more normal, and see if that removes the issue...I just wanted to see if this is something you've come across.

@dai-shi
Copy link
Owner Author

dai-shi commented Mar 19, 2020

If it's not occurring for you, it's likely due to my system.

Not for me. Most likely, it's from somewhere around dispatch in your system.
I'm not 100% sure, though. useMutableSource is still new to us.

@dai-shi
Copy link
Owner Author

dai-shi commented May 13, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Jul 4, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Aug 4, 2020

@dai-shi
Copy link
Owner Author

dai-shi commented Dec 18, 2020

Although useMutableSource hasn't landed, let me merge this PR and update README to indicate this is still an experimental project.

@dai-shi dai-shi merged commit ae99edf into master Dec 18, 2020
@dai-shi dai-shi deleted the new-api-with-use-mutable-source branch Dec 18, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants