Skip to content

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

Open
DaveyEke wants to merge 2 commits into
margelo:mainfrom
DaveyEke:fix/buffer-hook
Open

DaveyEke wants to merge 2 commits 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.

@mrousavy mrousavy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! just some clarification

Comment thread packages/react-native-mmkv/src/hooks/createMMKVHook.ts Outdated
Comment thread packages/react-native-mmkv/src/hooks/createMMKVHook.ts
@DaveyEke

DaveyEke commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! just some clarification

no issues, I've replied to them

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.

2 participants