stream-chat 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -876,6 +876,7 @@ export class MessageIntervalPaginator extends BasePaginator<
876
876
  this.claimActiveInterval();
877
877
  this.showLoadedInterval(interval);
878
878
  } else {
879
+ const checkWasStateResetDuringQuery = this.makeStateResetWatcher();
879
880
  const result = await this.executeQuery({
880
881
  claimsActiveInterval: true,
881
882
  // Always send a limit: the replies endpoint ignores `id_around` without one.
@@ -885,6 +886,8 @@ export class MessageIntervalPaginator extends BasePaginator<
885
886
  });
886
887
  // a later claim decides the active interval, and the page stays stored
887
888
  if (result?.isSuperseded) return false;
889
+ // a reset ignored the query: not a failed jump
890
+ if (checkWasStateResetDuringQuery()) return false;
888
891
  localMessage = this.getItem(messageId);
889
892
  if (!localMessage || !result || !result.targetInterval) {
890
893
  this.channel.getClient().notifications.addError({
@@ -957,6 +960,7 @@ export class MessageIntervalPaginator extends BasePaginator<
957
960
  */
958
961
  jumpToTheLatestMessage = async (options?: JumpToMessageOptions): Promise<boolean> => {
959
962
  if (!this.latestHeadInterval) {
963
+ const checkWasStateResetDuringQuery = this.makeStateResetWatcher();
960
964
  const result = await this.executeQuery({
961
965
  claimsActiveInterval: true,
962
966
  queryShape: { limit: this.pageSize },
@@ -964,6 +968,8 @@ export class MessageIntervalPaginator extends BasePaginator<
964
968
  });
965
969
  // a later claim decides the active interval, and the page stays stored
966
970
  if (result?.isSuperseded) return false;
971
+ // a reset ignored the query: not a failed jump
972
+ if (checkWasStateResetDuringQuery()) return false;
967
973
  }
968
974
 
969
975
  const latestMessageId = this.latestHeadInterval?.itemIds.slice(-1)[0];
@@ -1856,6 +1862,16 @@ export class MessageIntervalPaginator extends BasePaginator<
1856
1862
  this.messageFocusSignal.next({ signal: null });
1857
1863
  };
1858
1864
 
1865
+ /**
1866
+ * Also drops the focus signal of an earlier jump. Whatever claims the active interval decides what
1867
+ * is shown, so the earlier target must not be scrolled to or highlighted there. A jump claims
1868
+ * before it emits its own signal, so it keeps that one.
1869
+ */
1870
+ protected override claimActiveInterval(): number {
1871
+ this.clearMessageFocusSignal();
1872
+ return super.claimActiveInterval();
1873
+ }
1874
+
1859
1875
  clearStateAndCache() {
1860
1876
  this.resetState();
1861
1877
  this._itemIndex.clear();
@@ -722,6 +722,7 @@ export class MessagePaginator extends MessageIntervalPaginator {
722
722
  });
723
723
 
724
724
  if (!inferredLastReadMessageId) {
725
+ const checkWasStateResetDuringQuery = this.makeStateResetWatcher();
725
726
  const result = await this.executeQuery({
726
727
  claimsActiveInterval: true,
727
728
  queryShape: {
@@ -733,6 +734,8 @@ export class MessagePaginator extends MessageIntervalPaginator {
733
734
  });
734
735
  // a later claim decides the active interval, and the page stays stored
735
736
  if (result?.isSuperseded) return false;
737
+ // a reset ignored the query: not a failed jump
738
+ if (checkWasStateResetDuringQuery()) return false;
736
739
  if (result) {
737
740
  ({
738
741
  firstUnreadMessageId: inferredFirstUnreadMessageId,