Skip to content

Commit

Permalink
fix garbage collector with custom storage
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Aug 28, 2022
1 parent 158924f commit d6225b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hazae41/xswr",
"version": "1.0.41",
"version": "1.0.42",
"author": "hazae41",
"license": "MIT",
"description": "The simplest React data (re)fetching library ever made",
Expand Down
6 changes: 3 additions & 3 deletions src/mods/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Core extends Ortho<string, State | undefined> {
subscribe<D = any, E = any>(
key: string | undefined,
listener: (x: State<D, E>) => void,
params: Params<D, E> = {}
_: Params<D, E> = {}
) {
if (!key) return

Expand Down Expand Up @@ -291,7 +291,7 @@ export class Core extends Ortho<string, State | undefined> {

this.counts.delete(key)

const current = await this.get(key)
const current = await this.get(key, params)
if (current?.expiration === undefined) return
if (current?.expiration === -1) return

Expand All @@ -302,7 +302,7 @@ export class Core extends Ortho<string, State | undefined> {
if (count !== undefined) return

this.timeouts.delete(key)
await this.delete(key)
await this.delete(key, params)
}

if (Date.now() > current.expiration) {
Expand Down

0 comments on commit d6225b4

Please sign in to comment.