Skip to content

fix: Prevent infinite re-render loop in useMMKVBuffer - #1092

Open
DaveyEke wants to merge 1 commit into
margelo:mainfrom
DaveyEke:fix/buffer-hook
Open

DaveyEke wants to merge 1 commit into
margelo:mainfrom
DaveyEke:fix/buffer-hook

Conversation

@DaveyEke

Copy link
Copy Markdown
Contributor

useMMKVBuffer causes an infinite re-render loop ("Maximum update depth exceeded") once the key holds a value.

This caches the value and only re-reads it when the key or instance changes, or when the key is written.

Test

Added example/__tests__/MMKVHooks.harness.tsx. All harness and Jest tests pass on iOS.

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.

1 participant