-
Notifications
You must be signed in to change notification settings - Fork 95
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
feat(useMemoCache): useMemo with cache #1063
Open
michaltarasiuk
wants to merge
27
commits into
react-hookz:master
Choose a base branch
from
michaltarasiuk:pr/useMemoCache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9d528b2
feat: add useMemoCache hook
michaltarasiuk c95a94c
feat: add example
michaltarasiuk 5d792bd
fix: example of useMemoCache hook
michaltarasiuk ad7faa9
fix: performence
michaltarasiuk 0054efa
fix: cached item from Array to Set
michaltarasiuk ed4d919
feat: add test cases for areHookInputsEqual
michaltarasiuk a10ecee
feat: set downlevelIteration to true
michaltarasiuk f5dfafa
feat: add custom areHookInputsEqual
michaltarasiuk 2fc981a
fix: deps of cache memo
michaltarasiuk 078f3a1
fix: reference of customAreHookInputsEqual
michaltarasiuk f0f898d
fix: remove export of objectIs
michaltarasiuk b9347e0
feat: resolve conflicts
michaltarasiuk daa1f6e
feat: cover objectIs helper by test cases
michaltarasiuk a458b1d
feat: cover is helper by test cases
michaltarasiuk fc2dd98
fix: unstable refference of customAreHookInputsEqual
michaltarasiuk e253c3a
fix: docs of useMemoCache
michaltarasiuk 8cf0cd1
feat: resolve conflicts
michaltarasiuk afe9ffd
feat: remove dist
michaltarasiuk 6e6b7c9
feat: adapt to requirements
michaltarasiuk 09c81e6
feat: add assertion before add to cache
michaltarasiuk 22e5240
fix: naming
michaltarasiuk 82b423f
fix: code review fix
michalt-monogo dfd6913
feat: useMemo to useCustomCompareMemo
michalt-monogo 216a58a
feat: simplify cache
michalt-monogo 6cda934
feat: add max entries logic
michalt-monogo 2c82fc9
fix: index counter
michalt-monogo ce8ff2f
feat: simplified cache
michalt-monogo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just check
cache.size
to determine the current size of the cache? This counter seems unnecessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
indexCounter
is used to determine which element should be removed when threshold is hitThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Now I wonder if it would be better to just stop accepting new items to the cache after the maximum size is reached since the cache items are basically equally "important" so there is no reason to be deleting one item instead of another when the cache is filled.