@quenty/observablecollection 12.14.0 → 12.14.1-canary.522.b5d379b.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [12.14.1-canary.522.b5d379b.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.14.0...@quenty/observablecollection@12.14.1-canary.522.b5d379b.0) (2024-11-24)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * ObservableSortedList fires removed indexes (note: Doesn't handle negatives right now) ([f1c068d](https://github.com/Quenty/NevermoreEngine/commit/f1c068dd206b6a624e97cab86bb18c39e800a79a))
12
+
13
+
14
+
15
+
16
+
6
17
  # [12.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@12.13.0...@quenty/observablecollection@12.14.0) (2024-11-13)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/observablecollection",
3
- "version": "12.14.0",
3
+ "version": "12.14.1-canary.522.b5d379b.0",
4
4
  "description": "A set of observable collections, such as sets, maps, sorted lists, and more.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,24 +27,24 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/baseobject": "^10.7.1",
31
- "@quenty/brio": "^14.13.0",
32
- "@quenty/ducktype": "^5.7.1",
33
- "@quenty/loader": "^10.7.1",
34
- "@quenty/maid": "^3.4.0",
35
- "@quenty/promise": "^10.8.0",
36
- "@quenty/rx": "^13.13.0",
37
- "@quenty/signal": "^7.9.0",
38
- "@quenty/steputils": "^3.5.2",
39
- "@quenty/symbol": "^3.3.0",
40
- "@quenty/table": "^3.7.0",
41
- "@quenty/valueobject": "^13.13.0"
30
+ "@quenty/baseobject": "10.7.1",
31
+ "@quenty/brio": "14.13.1-canary.522.b5d379b.0",
32
+ "@quenty/ducktype": "5.7.1",
33
+ "@quenty/loader": "10.7.1",
34
+ "@quenty/maid": "3.4.0",
35
+ "@quenty/promise": "10.8.0",
36
+ "@quenty/rx": "13.13.1-canary.522.b5d379b.0",
37
+ "@quenty/signal": "7.9.0",
38
+ "@quenty/steputils": "3.5.2",
39
+ "@quenty/symbol": "3.3.0",
40
+ "@quenty/table": "3.7.0",
41
+ "@quenty/valueobject": "13.13.1-canary.522.b5d379b.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@quenty/blend": "^12.13.0"
44
+ "@quenty/blend": "12.13.1-canary.522.b5d379b.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "451334becfa36a10b55fa53cbdd88091cdf9ddbf"
49
+ "gitHead": "b5d379b3553fb94b954870562e1bd2a57e9a1c10"
50
50
  }
@@ -298,17 +298,14 @@ end
298
298
  function ObservableSortedList:ObserveAtIndex(indexToObserve)
299
299
  assert(type(indexToObserve) == "number", "Bad indexToObserve")
300
300
 
301
- return self._indexObservers:Observe(indexToObserve)
302
- :Pipe({
303
- Rx.start(function()
304
- local node = self:_findNodeAtIndex(indexToObserve)
305
- if node then
306
- return node.data, node
307
- else
308
- return nil
309
- end
310
- end);
311
- })
301
+ return self._indexObservers:Observe(indexToObserve, function(sub)
302
+ local node = self:_findNodeAtIndex(indexToObserve)
303
+ if node then
304
+ sub:Fire(node.data, node)
305
+ else
306
+ sub:Fire(nil, nil)
307
+ end
308
+ end)
312
309
  end
313
310
 
314
311
  --[=[
@@ -321,16 +318,12 @@ end
321
318
  function ObservableSortedList:ObserveIndexByKey(node)
322
319
  assert(SortedNode.isSortedNode(node), "Bad node")
323
320
 
324
- return self._nodeIndexObservables:Observe(node):Pipe({
325
- Rx.startFrom(function()
326
- local currentIndex = self:_findNodeIndex(node)
327
- if currentIndex then
328
- return { currentIndex }
329
- else
330
- return {}
331
- end
332
- end);
333
- })
321
+ return self._nodeIndexObservables:Observe(node, function(sub)
322
+ local currentIndex = self:_findNodeIndex(node)
323
+ if currentIndex then
324
+ sub:Fire(currentIndex)
325
+ end
326
+ end)
334
327
  end
335
328
 
336
329
  --[=[
@@ -494,12 +487,11 @@ function ObservableSortedList:_fireEvents()
494
487
  local nodesRemoved = self._nodesRemoved
495
488
  self._nodesRemoved = {}
496
489
 
490
+ local lastCount = self._countValue.Value
491
+ local newCount = if self._root then self._root.descendantCount else 0
492
+
497
493
  -- Fire count changed first
498
- if self._root then
499
- self._countValue.Value = self._root.descendantCount
500
- else
501
- self._countValue.Value = 0
502
- end
494
+ self._countValue.Value = newCount
503
495
 
504
496
  if not self.Destroy then return end
505
497
 
@@ -532,6 +524,12 @@ function ObservableSortedList:_fireEvents()
532
524
  self._indexObservers:Fire(index, node.data, node)
533
525
  self._indexObservers:Fire(negative, node.data, node)
534
526
  end
527
+
528
+ for index=newCount+1, lastCount do
529
+ self._indexObservers:Fire(index, nil, nil)
530
+ end
531
+
532
+ -- TODO: Fire negatives beyond range
535
533
  end
536
534
 
537
535
  if not self.Destroy then return end