Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
381 stars 7 forks source link

feat(react): make timestamp generation easily overridable; fix statusChanged event order #17

Closed bowheart closed 1 year ago

bowheart commented 1 year ago

Description

We generate timestamps/high-res timestamps in several places. These values end up in graph views and ecosystem dehydrations which is annoying for snapshot testing especially. Make all these calls go through a single method - IdGenerator#now. Now you only have to override the IdGenerator class's generateId and now methods to create fully-reproducible ids.

We may expand this someday to use functions or an IdGenerator-extending class that you pass to createEcosystem. Bu monkey-patching in test envs is good enough for now.