Bidirectional Linking (#622)

Allows bidirectional / cyclic linking for same-record cursor links.
This should allow multiple sections to all synchronize their cursors,
such that clicking in any one of them will move all the others.

Works even if some sections in the cycle have rows filtered out (the 
filtered-out sections might desync their cursors, but the correct cursor
position will still propagate downstream, and they'll re-sync if clicking on
a row that is present in them)

Under the hood, each cursor has a _lastEditedAt counter, updated when
a user's action changes the cursor in a section, such that we can always
tell which section was touched most recently. This is used to resolve
conflicts stably when dealing with cycles or chains of cursor-links.

Updated selectBy and recursiveMoveToCursorPos to handle cycles

Updated tests for selectBy behavior

However, main bidirectional-linking tests are not in this commit, they'll come in a subsequent PR
This commit is contained in:
Janet Vorobyeva
2023-09-25 18:48:18 -04:00
committed by GitHub
parent a48bd85db3
commit 29f07a8a4f
8 changed files with 335 additions and 38 deletions

View File

@@ -63,9 +63,23 @@ describe('RightPanelSelectBy', function() {
});
it('should disallow creating cycles', async function() {
it('should disallow creating cycles if not cursor-linked', async function() {
//Link "films record" by "performances record"
await gu.openSelectByForSection('FILMS RECORD');
await driver.findContent('.test-select-row', /Performances record.*Film/i).click();
await gu.waitForServer();
// this link should no longer be present, since it would create a cycle with a filter link in it
await gu.openSelectByForSection('PERFORMANCES RECORD');
assert.equal(await driver.findContent('.test-select-row', /Performances detail/).isPresent(), false);
assert.equal(await driver.findContent('.test-select-row', /Performances record.*Film/i).isPresent(), false);
});
it('should allow creating cursor-linked-cycles', async function() {
assert.equal(await driver.findContent('.test-select-row', /Performances detail/).isPresent(), true);
// undo, the operation from the previous test; link is expected to be unset for next test
await gu.undo();
});