@quenty/datastore 7.1.0 → 7.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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
+ # [7.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.1.0...@quenty/datastore@7.2.0) (2022-10-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Import maid ([638e529](https://github.com/Quenty/NevermoreEngine/commit/638e529d87b3ae4df73482e91153540f41baaf36))
12
+
13
+
14
+ ### Features
15
+
16
+ * Free DataStore key after its writer GCs to allow future writers ([9b2e8a2](https://github.com/Quenty/NevermoreEngine/commit/9b2e8a29332aacb99ac47550af37708f58cd39e5))
17
+
18
+
19
+
20
+
21
+
6
22
  # [7.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@7.0.0...@quenty/datastore@7.1.0) (2022-10-11)
7
23
 
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/datastore",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Quenty's Datastore implementation for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "69c2153865684748d0a8d6806f1ff999685c2e55"
41
+ "gitHead": "70aa9ff7fc254e98d1950a27a4b94751839e6b21"
42
42
  }
@@ -13,6 +13,7 @@ local require = require(script.Parent.loader).load(script)
13
13
  local BaseObject = require("BaseObject")
14
14
  local DataStoreDeleteToken = require("DataStoreDeleteToken")
15
15
  local DataStoreWriter = require("DataStoreWriter")
16
+ local Maid = require("Maid")
16
17
  local Promise = require("Promise")
17
18
  local PromiseUtils = require("PromiseUtils")
18
19
  local Signal = require("Signal")
@@ -241,7 +242,7 @@ end
241
242
  Whenever the ValueObject changes, stores the resulting value in that entry.
242
243
  @param name string
243
244
  @param valueObj Instance -- ValueBase object to store on
244
- @return MaidTask
245
+ @return MaidTask -- Cleanup to remove this writer and free the key.
245
246
  ]=]
246
247
  function DataStoreStage:StoreOnValueChange(name, valueObj)
247
248
  assert(type(name) == "string", "Bad name")
@@ -251,12 +252,18 @@ function DataStoreStage:StoreOnValueChange(name, valueObj)
251
252
  error(("[DataStoreStage] - Already have a writer for %q"):format(name))
252
253
  end
253
254
 
255
+ local maid = Maid.new()
256
+
254
257
  self._takenKeys[name] = true
255
- local conn = valueObj.Changed:Connect(function()
256
- self:_doStore(name, valueObj.Value)
258
+ maid:GiveTask(function()
259
+ self._takenKeys[name] = nil
257
260
  end)
258
- self._maid:GiveTask(conn)
259
- return conn
261
+
262
+ maid:GiveTask(valueObj.Changed:Connect(function()
263
+ self:_doStore(name, valueObj.Value)
264
+ end))
265
+
266
+ return maid
260
267
  end
261
268
 
262
269
  --[=[