@quenty/observablecollection 9.0.1-canary.445.ee7e5d6.0 → 11.0.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,7 +3,18 @@
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
- ## [9.0.1-canary.445.ee7e5d6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@9.0.0...@quenty/observablecollection@9.0.1-canary.445.ee7e5d6.0) (2024-02-14)
6
+ # [11.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@10.0.0...@quenty/observablecollection@11.0.0) (2024-02-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix sorting errors ([43ac468](https://github.com/Quenty/NevermoreEngine/commit/43ac468dd49147011c04e9d61e08573fb543423c))
12
+
13
+
14
+
15
+
16
+
17
+ # [10.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/observablecollection@9.0.0...@quenty/observablecollection@10.0.0) (2024-02-13)
7
18
 
8
19
 
9
20
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/observablecollection",
3
- "version": "9.0.1-canary.445.ee7e5d6.0",
3
+ "version": "11.0.0",
4
4
  "description": "A set of observable collections, such as sets, maps, sorted lists, and more.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,23 +27,23 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/baseobject": "8.0.1-canary.445.ee7e5d6.0",
31
- "@quenty/brio": "12.0.1-canary.445.ee7e5d6.0",
32
- "@quenty/ducktype": "3.0.1-canary.445.ee7e5d6.0",
33
- "@quenty/loader": "8.0.1-canary.445.ee7e5d6.0",
34
- "@quenty/maid": "3.0.0",
35
- "@quenty/promise": "8.0.1-canary.445.ee7e5d6.0",
36
- "@quenty/rx": "11.0.1-canary.445.ee7e5d6.0",
37
- "@quenty/signal": "5.0.1-canary.445.ee7e5d6.0",
38
- "@quenty/steputils": "3.3.0",
39
- "@quenty/symbol": "3.0.0",
40
- "@quenty/valueobject": "11.0.1-canary.445.ee7e5d6.0"
30
+ "@quenty/baseobject": "^9.0.0",
31
+ "@quenty/brio": "^13.0.0",
32
+ "@quenty/ducktype": "^4.0.0",
33
+ "@quenty/loader": "^9.0.0",
34
+ "@quenty/maid": "^3.0.0",
35
+ "@quenty/promise": "^9.0.0",
36
+ "@quenty/rx": "^12.0.0",
37
+ "@quenty/signal": "^6.0.0",
38
+ "@quenty/steputils": "^3.3.0",
39
+ "@quenty/symbol": "^3.0.0",
40
+ "@quenty/valueobject": "^12.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@quenty/blend": "10.0.1-canary.445.ee7e5d6.0"
43
+ "@quenty/blend": "^11.0.0"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "ee7e5d6ada857eba67b462aa37a00de9f430ae97"
48
+ "gitHead": "77d0a0b5b59a512311fa07293fb573953fcacbeb"
49
49
  }
@@ -15,7 +15,14 @@ FilteredObservableListView.__index = FilteredObservableListView
15
15
 
16
16
  -- Higher numbers last
17
17
  local function defaultCompare(a, b)
18
- return a < b
18
+ -- equivalent of `return a - b` except it supports comparison of strings and stuff
19
+ if b > a then
20
+ return -1
21
+ elseif b < a then
22
+ return 1
23
+ else
24
+ return 0
25
+ end
19
26
  end
20
27
 
21
28
  function FilteredObservableListView.new(observableList, observeScoreCallback, compare)
@@ -25,15 +32,14 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
25
32
  self._baseList = assert(observableList, "No observableList")
26
33
  self._observeScoreCallback = assert(observeScoreCallback, "No observeScoreCallback")
27
34
 
28
- self._scoredList = ObservableSortedList.new(false, function(a, b)
35
+ self._scoredList = self._maid:Add(ObservableSortedList.new(false, function(a, b)
29
36
  -- Preserve index when scoring does not
30
37
  if a.score == b.score then
31
38
  return a.index - b.index
32
39
  else
33
40
  return self._compare(a.score, b.score)
34
41
  end
35
- end)
36
- self._maid:GiveTask(self._scoredList)
42
+ end))
37
43
 
38
44
  -- Shockingly this is somewhat performant because the sorted list defers all events
39
45
  -- to process the list reordering.
@@ -58,8 +64,6 @@ function FilteredObservableListView.new(observableList, observeScoreCallback, co
58
64
  return state
59
65
  end)
60
66
  }))
61
-
62
-
63
67
  end))
64
68
 
65
69
  return self
@@ -632,7 +632,9 @@ function ObservableSortedList:_highBinarySearch(sortValue)
632
632
  while true do
633
633
  local mid = math.floor((minIndex + maxIndex) / 2)
634
634
  local compareValue = self._compare(self._sortValue[self._keyList[mid]], sortValue)
635
- assert(type(compareValue) == "number", "Expecting number")
635
+ if type(compareValue) ~= "number" then
636
+ error(string.format("Bad compareValue, expected number, got %q", type(compareValue)))
637
+ end
636
638
 
637
639
  if self._isReversed then
638
640
  compareValue = -compareValue