Skip to content

Commit

Permalink
useVingKind().reset() is removed. Use .dispose() instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
rizen committed Oct 25, 2024
1 parent e6e7a05 commit 15650ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
18 changes: 4 additions & 14 deletions app/composables/ving/useVingKind.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,16 @@ class VingKind {

/**
* Frees the memory associated with the list of records
* @returns {object} The current instance of this kind.
* @example
* onBeforeRouteLeave(() => users.dispose());
*/
dispose() {
for (const record of this.records) {
record.dispose();
}
this.reset();
this.records.splice(0);
return this;
}

/**
Expand Down Expand Up @@ -404,18 +406,6 @@ class VingKind {
}
}

/**
* Locally empties the `records` array.
*
* @returns {object} A reference to this object for chaining
* @example
* users.reset()
*/
reset() {
this.records.splice(0);
return this;
}

/**
* Sets the `new` property back to its default state. Something you usually want to do after you create a new record.
* @example
Expand Down Expand Up @@ -448,7 +438,7 @@ class VingKind {
if (!response.error) {
const data = response.data;
if (options.accumulate != true) {
this.reset();
this.dispose();
}
for (let index = 0; index < data.items.length; index++) {
this.append({ id: data.items[index].props.id, ...data.items[index] }, options);
Expand Down
1 change: 1 addition & 0 deletions ving/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ outline: deep
* Added error handling to verifyExtension() in S3File.
* Added validation for acceptedFileExtensions in ving schemas being in the wrong place.
* Make ioredis quit gracefully.
* useVingKind().reset() is removed. Use .dispose() instead.

### 2024-10-24
* Installed dotenv for environment variables.
Expand Down

0 comments on commit 15650ef

Please sign in to comment.