zustandjs / zustand-slices

A slice utility for Zustand
MIT License
137 stars 6 forks source link

use Maps to only iterate through slices that actually have a given action #2

Closed EskiMojo14 closed 2 months ago

EskiMojo14 commented 2 months ago

i saw a FIXME and got an itch

there isn't really a test suite yet as far as i can tell, but i tried it out with the example and it still worked correctly

EskiMojo14 commented 2 months ago

out of curiosity, is calling set multiple times particularly inefficient? you could always do the iteration inside a single set call instead, building out the object as you go

dai-shi commented 2 months ago

wow, nice! thanks for working on it. yeah, let's add some tests first. would you like to work on it? using @testing-library/react and testing at the component level would be good.

right, calling set multiple times isn't super efficient (it's still render optimized, though.)

EskiMojo14 commented 2 months ago

sure - do you want a separate PR for tests or should I just add them to this one?

EskiMojo14 commented 2 months ago

opened #3 with tests