substance/substance-legacy

Issue with incremental index update

michael opened this issue · 4 comments

An array update operations kills index.

var tx = this.props.writerCtrl.doc.startTransaction();
tx.set([this.props.subjectReferenceId, "target"], subjectIds);
tx.save();

While graph object is updated accordingly, the index returns invalid results after:

image

Reproduce:

  • activate a subject_reference
  • tick a new subject
  • switch to subjects-panel

If possible, try to fix it yourself.

Ok i will try. just don't fully understand yet, how the index updates work (also in combination with ops and transactions).

Our of curiousity, when a transaction document is modified, are there also copies of the indexes of the original doc?

Yup, the transaction doc is totally independent. These index copies are created in https://github.com/substance/substance/blob/next/src/document/transaction_document.js#L19

In both, indexes are called explicitly from graph, e.g., https://github.com/substance/substance/blob/next/src/data/graph.js#L133