polfan-server-js-client 0.2.103 → 0.2.105

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.103",
3
+ "version": "0.2.105",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -203,7 +203,7 @@ export abstract class TraversableRemoteCollection<
203
203
  }
204
204
 
205
205
  public async jumpTo(id: string): Promise<void> {
206
- if (this.internalState.ongoing || this._items.has(id)) {
206
+ if (this.internalState.ongoing || (this.state !== WindowState.LIVE && this._items.has(id))) {
207
207
  return;
208
208
  }
209
209
 
@@ -214,18 +214,17 @@ export abstract class TraversableRemoteCollection<
214
214
  try {
215
215
  result = await this.fetchItemsAround(id);
216
216
  this.internalState.lastFetchCount = result ? result.length : 0;
217
+
218
+ if (result) {
219
+ this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
220
+ this.addItems(result, 'tail');
221
+ await this.refreshFetchedState();
222
+ }
217
223
  } finally {
218
224
  this.internalState.ongoing = undefined;
219
225
  }
220
226
 
221
- if (!result) {
222
- return;
223
- }
224
-
225
- this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
226
- this.addItems(result, 'tail');
227
- this.internalState.current = WindowState.PAST;
228
- this.emitChangeWithDiff(true, originalState);
227
+ this.emitChangeWithDiff(!!result, originalState);
229
228
  }
230
229
 
231
230
  protected abstract fetchLatestItems(): Promise<ItemT[]>;