Skip to content

Conversation

@okwasniewski
Copy link
Member

@okwasniewski okwasniewski commented Jan 9, 2026

Summary

  • Add optional selector and equalityFn params to useBrownieStore hook
  • Use useSyncExternalStoreWithSelector for optimized re-renders
  • Export shallow equality helper (zustand-style)
  • Add tests for shallow comparison
  • Update TesterIntegrated example with selector usage

New API:

// With selector - only re-renders when selected value changes
const [count, setState] = useStore('Store', s => s.count)

// With selector + shallow equality for objects
const [user, setState] = useStore('Store', s => s.user, shallow)

@okwasniewski okwasniewski force-pushed the oskar/brownie-selectors branch from 1a38943 to 36d0721 Compare January 9, 2026 12:17
@okwasniewski okwasniewski force-pushed the oskar/brownie-selectors branch from 36d0721 to 2f2ed68 Compare January 9, 2026 12:28
- rename useBrownieStore -> useStore
- use React's useSyncExternalStore instead of shim
- remove shallow equality fn (zustand-style API)
- replace ts-jest with babel-jest
@thymikee thymikee changed the title feat(brownie): add selector and equality fn support to useBrownieStore feat(brownie): add selector and equality fn support to useStore Jan 9, 2026
@okwasniewski okwasniewski merged commit f8aeecb into main Jan 9, 2026
4 checks passed
@okwasniewski okwasniewski deleted the oskar/brownie-selectors branch January 9, 2026 14:05
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.

3 participants