xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
23 stars 8 forks source link

Further performance improvements to `Store.loadData()` #2332

Open lbwexler opened 3 years ago

lbwexler commented 3 years ago
amcclain commented 3 years ago

The latter two could be handled by one or more overrideable methods on Store - e.g. rawDatasAreEqual() and recordsAreEqual(). Apps could then check something like an app-specific timestamp or hash in either, or could make the latter trivial if the first one passes, etc.

Hand waving here around how raw data equality check would fit in with / influence new record comparison. Seems like it could support a use case where an app knows that raw data change is sufficient to detect record change. New records would only be created if rawData changed, and then all such new records would be applied without further equality checks. Overridden recordsAreEqual() could always return false to trigger that latter behavior, although would want to think through / revise the names to clarify that the comparison method was only used during load/update.