Skip to content

Hooks behaviour change 📎

Compare
Choose a tag to compare
@mesqueeb mesqueeb released this 09 Jan 07:56
· 183 commits to master since this release
2bd888f

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:

  1. sync.patchHook
  2. serverChange.modifiedHook

Now: it only triggers:

  1. sync.patchHook

Please review the "execution timing of hooks" which is now greatly simplified!

Enjoy!!! 🌋