re-reselect | Enhance Reselect selectors with deeper memoization | Caching library

 by   toomuchdesign TypeScript Version: 5.1.0 License: MIT

kandi X-RAY | re-reselect Summary

kandi X-RAY | re-reselect Summary

re-reselect is a TypeScript library typically used in Server, Caching applications. re-reselect has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

re-reselect is a lightweight wrapper around Reselect meant to enhance selectors with deeper memoization and cache management. Switching between different arguments using standard reselect selectors causes cache invalidation since default reselect cache has a limit of one. re-reselect forwards different calls to different reselect selectors stored in cache, so that computed/memoized values are retained. re-reselect selectors work as normal reselect selectors but they are able to determine when creating a new selector or querying a cached one on the fly, depending on the supplied arguments.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              re-reselect has a medium active ecosystem.
              It has 1056 star(s) with 47 fork(s). There are 7 watchers for this library.
              There were 2 major release(s) in the last 6 months.
              There are 4 open issues and 39 have been closed. On average issues are closed in 49 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of re-reselect is 5.1.0

            kandi-Quality Quality

              re-reselect has no bugs reported.

            kandi-Security Security

              re-reselect has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              re-reselect is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              re-reselect releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of re-reselect
            Get all kandi verified functions for this library.

            re-reselect Key Features

            No Key Features are available at this moment for re-reselect.

            re-reselect Examples and Code Snippets

            No Code Snippets are available at this moment for re-reselect.

            Community Discussions

            QUESTION

            React / Redux / Pure Component with an array property re-renders when the array has not changed
            Asked 2020-Jan-08 at 12:44

            I have a React / Redux app that renders a grid of PureComponents. I want the components to only re-render when a prop value has changed, but in fact all components re-render on any update to store. The issue appears to be caused by an array property.

            I've reproduced the issue in this sandbox. In this minimal example, two instances of the Cell component are rendered. Each displays a value that is separately recorded in the store, and can be incremented or decremented separately with a button.

            Cell.js

            ...

            ANSWER

            Answered 2020-Jan-08 at 10:48

            You are creating a new array on every mapStateToProps call with myArray: [0, 1, 2]. Because of this, mapStateToProps always returns an object with a new instance of an array.

            Redux than does a shallow comparison of the previous props. The references of myArray changed, since oyu created a new one during the call and all cells get udpated. By removing the myArray: [0, 1, 2] line, it works as expected. Move that array into redux, so that you do not generate a new one of every call.

            The pure component is also useless, since redux already does a prop comparison and the pure component does the same thing again, so that is wasted since it always has the same result for redux and the pure component and is just more work.

            Update: You are still creating a new array on every mapSateToPropsCall with the map function in getMyArray, since map returns a new array. Why do you not make the array static or memoize that, so that you only generate a new one, if needed?

            Why do you not change how you save the data so that state.myArray[index] returns the needed array?

            And you still can transform the PureCompoennt to Component.

            Source https://stackoverflow.com/questions/59641706

            QUESTION

            React / Redux: how to update one cell of a grid without re-rendering all the others
            Asked 2020-Jan-08 at 08:10

            I have a React / Redux app in which I draw a 2-dimensional grid. The grid data is in the Redux store, as an array of arrays. e.g. for a 3x2 grid it might be like this:

            ...

            ANSWER

            Answered 2020-Jan-07 at 20:51

            I think you missunderstand the mapStateToProps function. It will be called for every redux state update and it has to figure out, if the values for that changed. So it has to call every mapStateToProps for each cell.

            That does not mean, though, that it rerenders that component. If the previous and current return values of mapStateToProps are the same, the update will be aborted.

            So it is correct that the mapStateToProps is called. Check if the cells are actually rerendered. You can also remove the getValueCached wrapper and access the grid directly with state.grid[identifiers[0]][identifiers[1]]. This will be faster than the cached version since its just a direct access. And you do not get any benefit from the cached version, since its not a heavy computation.

            It might even be faster to connect the highest component and jsut let it rerender if needed. Another option is to use react-window to only render the current visible grid items, which will greatly improve your performance.

            Source https://stackoverflow.com/questions/59635021

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install re-reselect

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i re-reselect

          • CLONE
          • HTTPS

            https://github.com/toomuchdesign/re-reselect.git

          • CLI

            gh repo clone toomuchdesign/re-reselect

          • sshUrl

            git@github.com:toomuchdesign/re-reselect.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Caching Libraries

            caffeine

            by ben-manes

            groupcache

            by golang

            bigcache

            by allegro

            DiskLruCache

            by JakeWharton

            HanekeSwift

            by Haneke

            Try Top Libraries by toomuchdesign

            next-page-tester

            by toomuchdesignTypeScript

            react-minimal-pie-chart

            by toomuchdesignTypeScript

            offside

            by toomuchdesignJavaScript

            next-use-contextual-routing

            by toomuchdesignTypeScript

            postcss-nested-ancestors

            by toomuchdesignJavaScript