@tanstack/react-store
Advanced tools
Comparing version 0.0.1-beta.86 to 0.0.1-beta.87
@@ -14,7 +14,7 @@ { | ||
"name": "store/build/esm/index.js", | ||
"uid": "957e-6" | ||
"uid": "3b45-6" | ||
}, | ||
{ | ||
"name": "react-store/src/index.tsx", | ||
"uid": "957e-8" | ||
"uid": "3b45-8" | ||
} | ||
@@ -29,20 +29,20 @@ ] | ||
"nodeParts": { | ||
"957e-6": { | ||
"renderedLength": 1395, | ||
"gzipLength": 505, | ||
"3b45-6": { | ||
"renderedLength": 1417, | ||
"gzipLength": 507, | ||
"brotliLength": 0, | ||
"mainUid": "957e-5" | ||
"mainUid": "3b45-5" | ||
}, | ||
"957e-8": { | ||
"3b45-8": { | ||
"renderedLength": 754, | ||
"gzipLength": 343, | ||
"brotliLength": 0, | ||
"mainUid": "957e-7" | ||
"mainUid": "3b45-7" | ||
} | ||
}, | ||
"nodeMetas": { | ||
"957e-5": { | ||
"3b45-5": { | ||
"id": "/packages/store/build/esm/index.js", | ||
"moduleParts": { | ||
"index.production.js": "957e-6" | ||
"index.production.js": "3b45-6" | ||
}, | ||
@@ -52,17 +52,17 @@ "imported": [], | ||
{ | ||
"uid": "957e-7" | ||
"uid": "3b45-7" | ||
} | ||
] | ||
}, | ||
"957e-7": { | ||
"3b45-7": { | ||
"id": "/packages/react-store/src/index.tsx", | ||
"moduleParts": { | ||
"index.production.js": "957e-8" | ||
"index.production.js": "3b45-8" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "957e-9" | ||
"uid": "3b45-9" | ||
}, | ||
{ | ||
"uid": "957e-5" | ||
"uid": "3b45-5" | ||
} | ||
@@ -73,3 +73,3 @@ ], | ||
}, | ||
"957e-9": { | ||
"3b45-9": { | ||
"id": "use-sync-external-store/shim/with-selector", | ||
@@ -80,3 +80,3 @@ "moduleParts": {}, | ||
{ | ||
"uid": "957e-7" | ||
"uid": "3b45-7" | ||
} | ||
@@ -83,0 +83,0 @@ ], |
@@ -34,2 +34,5 @@ /** | ||
this.options = options; | ||
if (this.options?.onUpdate) { | ||
this.subscribe(this.options?.onUpdate); | ||
} | ||
} | ||
@@ -47,4 +50,2 @@ subscribe = listener => { | ||
this.state = this.options?.updateFn ? this.options.updateFn(previous)(updater) : updater(previous); | ||
if (this.state === previous) return; | ||
this.options?.onUpdate?.(this.state, previous); | ||
this.#flush(previous); | ||
@@ -56,3 +57,3 @@ }; | ||
this.listeners.forEach(listener => { | ||
if (this.#flushing !== flushId) return; | ||
if (this.#flushing !== flushId || this.state === previous) return; | ||
listener(this.state, previous); | ||
@@ -59,0 +60,0 @@ }); |
@@ -21,3 +21,3 @@ /** | ||
* @license MIT | ||
*/function s(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!1;for(let i=0;i<s.length;i++)if(!Object.prototype.hasOwnProperty.call(e,s[i])||!Object.is(t[s[i]],e[s[i]]))return!1;return!0}t.Store=class{listeners=new Set;#t=!1;#e=0;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=t=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.state!==e&&(this.options?.onUpdate?.(this.state,e),this.#s(e))};#s=t=>{if(this.#t)return;const e=++this.#e;this.listeners.forEach((s=>{this.#e===e&&s(this.state,t)}))};batch=t=>{if(this.#t)return t();const e=this.state;this.#t=!0,t(),this.#t=!1,this.#s(e)}},t.shallow=s,t.useStore=function(t,i=(t=>t)){return e.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),i,s)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
*/function s(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!1;for(let i=0;i<s.length;i++)if(!Object.prototype.hasOwnProperty.call(e,s[i])||!Object.is(t[s[i]],e[s[i]]))return!1;return!0}t.Store=class{listeners=new Set;#t=!1;#e=0;constructor(t,e){this.state=t,this.options=e,this.options?.onUpdate&&this.subscribe(this.options?.onUpdate)}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=t=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.#s(e)};#s=t=>{if(this.#t)return;const e=++this.#e;this.listeners.forEach((s=>{this.#e===e&&this.state!==t&&s(this.state,t)}))};batch=t=>{if(this.#t)return t();const e=this.state;this.#t=!0,t(),this.#t=!1,this.#s(e)}},t.shallow=s,t.useStore=function(t,i=(t=>t)){return e.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),i,s)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@tanstack/react-store", | ||
"author": "Tanner Linsley", | ||
"version": "0.0.1-beta.86", | ||
"version": "0.0.1-beta.87", | ||
"license": "MIT", | ||
@@ -39,3 +39,3 @@ "repository": "tanstack/react-store", | ||
"use-sync-external-store": "^1.2.0", | ||
"@tanstack/store": "0.0.1-beta.86" | ||
"@tanstack/store": "0.0.1-beta.87" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164569
354
+ Added@tanstack/store@0.0.1-beta.87(transitive)
- Removed@tanstack/store@0.0.1-beta.86(transitive)