mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
Changed to always accept incomingPos
Previously we'd set cursorPos=null if linked cursorPos was outdated relative to us. However, this caused issues (little arrow would disappear, wouldn't get set correctly when first setting selectBy) Removing it seems to work fine, since observables prevent looping and version keeps cycle terminated correctly
This commit is contained in:
parent
d3126bec62
commit
a0d6e44481
@ -258,16 +258,25 @@ export class LinkingState extends Disposable {
|
||||
//This is the cursorPos that's directly applied to tgtSection, should be null if incoming link is outdated
|
||||
//where null means "cursorPos does not apply to tgtSection and should be ignored"
|
||||
this.cursorPos = this.autoDispose(ko.computed(() => {
|
||||
const [incomingPos, incomingVersion]: [UIRowId|null, SequenceNum] = this.incomingCursorPos();
|
||||
const tgtSecVersion = this._tgtSection.lastCursorEdit();
|
||||
const [incomingPos, _]: [UIRowId|null, SequenceNum] = this.incomingCursorPos();
|
||||
return incomingPos;
|
||||
|
||||
//if(!tgtSecVersion) { return null; }
|
||||
// TODO JV: old code only accepted incomingPos if it was newer than tgtSec.
|
||||
// However I think we'll be ok with always taking incomingPos. I think the only weird case
|
||||
// is if we cycle back to ourselves, in which case we might end up setCursorPos()-ing ourselves
|
||||
// thru the link. However, that's not actually an issue? so it's probably fine
|
||||
|
||||
if(incomingVersion > tgtSecVersion) { // if linked cursor newer that current sec, use it
|
||||
return incomingPos;
|
||||
} else { // else, there's no linked cursor, since current section is driving the linking
|
||||
return null;
|
||||
}
|
||||
//const [incomingPos, incomingVersion]: [UIRowId|null, SequenceNum] = this.incomingCursorPos();
|
||||
//const tgtSecVersion = this._tgtSection.lastCursorEdit();
|
||||
|
||||
//if(!tgtSecVersion) { return null; } //TODO JV
|
||||
|
||||
// if(incomingVersion > tgtSecVersion) { // if linked cursor newer that current sec, use it
|
||||
// return incomingPos;
|
||||
// } else { // else, there's no linked cursor, since current section is driving the linking
|
||||
// return incomingPos; //TODO JV TEMP: let's try just always taking the incomingpos
|
||||
// //return null;
|
||||
// }
|
||||
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user