Limit recursion
Signed-off-by: RMidhunSuresh <hi@midhun.dev>
This commit is contained in:
parent
b2a8b243ec
commit
60a92cf6b7
1 changed files with 6 additions and 2 deletions
|
@ -49,7 +49,11 @@ export class TimelineViewModel extends ViewModel {
|
||||||
this._showJumpDown = false;
|
this._showJumpDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async watchForGapFill(gapPromise, gapTile) {
|
async watchForGapFill(gapPromise, gapTile, depth = 0) {
|
||||||
|
if (depth >= 10) {
|
||||||
|
console.error("watchForGapFill exceeded a recursive depth of 10");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let hasSeenUpdate = false;
|
let hasSeenUpdate = false;
|
||||||
const checkForUpdate = (idx, tile) => {
|
const checkForUpdate = (idx, tile) => {
|
||||||
if (tile.shape !== "gap") {
|
if (tile.shape !== "gap") {
|
||||||
|
@ -85,7 +89,7 @@ export class TimelineViewModel extends ViewModel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!hasSeenUpdate) {
|
if (!hasSeenUpdate) {
|
||||||
this.watchForGapFill(gapTile.notifyVisible(), gapTile);
|
this.watchForGapFill(gapTile.notifyVisible(), gapTile, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue