Hooks behaviour change 📎
I have had a breakthrough concerning hooks!
Previously vuex-easy-firestore used FieldValue.serverTimestamp()
for the default fields "updated_at" and "created_at". However, the problem was that a serverTimestamp
makes the hooks execute a "server" change even on a "local" change!
By changing these fields to just use a regular new Date()
a "server change" is not triggered at all and thus the Hooks have become much more usable! 🎉
The change is not really a "breaking" change, because even before, on a serverChange.modifiedHook
there was no changed data anyway, but nevertheless, if you used hooks before it's important to know the change in behaviour:
dispatch('module/set', {id, field: 'new value'})
Before: because of the "updated_at" field, this would trigger:
- sync.patchHook
- serverChange.modifiedHook
Now: it only triggers:
- sync.patchHook
Please review the "execution timing of hooks" which is now greatly simplified!
Enjoy!!! 🌋