Skip to content

bugfix: fix reactivity

Matthieu Fesselier requested to merge bugfix/reactivity into master

This fixes a reactivity issue found on sib-invoicing. The idea is just to, after a change on resource-1, to notify subscribed resources after all the nested resources of resource-1 have been re-fetched.

Example with edition of customer-invoices/2/:

nestedResources
  customer-invoices/2/batches/

toNotify (subscriptions)
  project/3/customerInvoices/
  batchs/14/
  batchs/1/

How it worked before:

  notify project/3/customerInvoices/ for re-render
  notify batchs/14/ for re-render
  notify batchs/1/ for re-render
  ...
  cache cleared for customer-invoices/2/batches/
  fetch customer-invoices/2/batches/
  re-render

The problem is that when we re-render the display of batchs/X/, the fetch of batches was not made already.
Which means that it re-rendered with the old data. I just added a then for publishing to subscriptions.

How it works now:

  cache cleared for customer-invoices/2/batches/
  fetch customer-invoices/2/batches/
  re-render
  ...
  notify project/3/customerInvoices/ for re-render
  notify batchs/14/ for re-render
  notify batchs/1/ for re-render

This way we are sure that everything has been re-fetched.

Edited by Benoit Alessandroni

Merge request reports