What
It would be useful to be able to conveniently determine if currentChange was triggered by node traversal (undo/redo/click on trrackViz) vs a user action causing a new node to be added to the track tree. This could be added as an argument in the currentChange callback, or property on the trrack object returned by initializeTrrack.
Why
My current approach to handling provenance with vue/pinia is to subscribe to changes on the pinia store then call the relevant prov.apply(...) function to update the trrack state. Then of prov.currentChange is triggered. Now we get to the branching logic.
Case 1: If we have a new node, we know this was triggered from a store update, so we don't want to make any changes to the store.
Case 2: If we move to an existing node, that means we must update the pinia store to update the ui.
Workaround
Right now, I have a working solution:
const prov = initializeTrrack(...);
const nodeIds = new Set<string>([prov.root.id]);
prov.currentChange(() => {
const provNodeId = prov.current.id;
if (nodeIds.has(prov.current.id)) {
// update pinia state based on trrack state
} else {
// do nothing
}
nodeIds.add(provNodeId);
});
So far, this appears to be working. I'm not sure how this will work with URL state sharing — it may require some updates, i.e. adding all of the state node ids on initial load probably.
What It would be useful to be able to conveniently determine if
currentChange
was triggered by node traversal (undo/redo/click on trrackViz) vs a user action causing a new node to be added to the track tree. This could be added as an argument in thecurrentChange
callback, or property on the trrack object returned byinitializeTrrack
.Why My current approach to handling provenance with vue/pinia is to subscribe to changes on the pinia store then call the relevant
prov.apply(...)
function to update the trrack state. Then ofprov.currentChange
is triggered. Now we get to the branching logic.Workaround Right now, I have a working solution:
So far, this appears to be working. I'm not sure how this will work with URL state sharing — it may require some updates, i.e. adding all of the state node ids on initial load probably.