Skip to content

Commit

Permalink
fix: Don't recreate JS TreeTable subscriptions when viewport changes
Browse files Browse the repository at this point in the history
Resolves an issue where subscription recreation would release an export
ticket that was still needed for the next subscription.

Also improves tree viewport performance by sending changes instead of
waiting for a new subscription to exist.

Fixes #6053
  • Loading branch information
niloc132 committed Sep 12, 2024
1 parent 41d5cc0 commit 9d10b70
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,25 @@ private void replaceSubscription(RebuildStep step) {
viewTicket.release();
viewTicket = null;
}
case SUBSCRIPTION:

// In all of the above cases, we replace the subscription
if (stream != null) {
stream.then(stream -> {
stream.close();
return null;
});
stream = null;
}
break;
case SUBSCRIPTION:
// If it exists, adjust the existing subscription, otherwise create a new one
if (stream != null) {
stream.then(subscription -> {
subscription.setViewport(firstRow, lastRow, Js.uncheckedCast(columns), (double) updateInterval);
return null;
});
return;
}
}

Promise<TreeSubscription> stream = Promise.resolve(defer())
Expand Down

0 comments on commit 9d10b70

Please sign in to comment.