@tanstack/react-store
Advanced tools
Comparing version 0.0.1-beta.87 to 0.0.1-beta.88
@@ -14,7 +14,7 @@ { | ||
"name": "store/build/esm/index.js", | ||
"uid": "3b45-6" | ||
"uid": "5d62-6" | ||
}, | ||
{ | ||
"name": "react-store/src/index.tsx", | ||
"uid": "3b45-8" | ||
"uid": "5d62-8" | ||
} | ||
@@ -29,20 +29,20 @@ ] | ||
"nodeParts": { | ||
"3b45-6": { | ||
"renderedLength": 1417, | ||
"gzipLength": 507, | ||
"5d62-6": { | ||
"renderedLength": 1323, | ||
"gzipLength": 492, | ||
"brotliLength": 0, | ||
"mainUid": "3b45-5" | ||
"mainUid": "5d62-5" | ||
}, | ||
"3b45-8": { | ||
"5d62-8": { | ||
"renderedLength": 754, | ||
"gzipLength": 343, | ||
"brotliLength": 0, | ||
"mainUid": "3b45-7" | ||
"mainUid": "5d62-7" | ||
} | ||
}, | ||
"nodeMetas": { | ||
"3b45-5": { | ||
"5d62-5": { | ||
"id": "/packages/store/build/esm/index.js", | ||
"moduleParts": { | ||
"index.production.js": "3b45-6" | ||
"index.production.js": "5d62-6" | ||
}, | ||
@@ -52,17 +52,17 @@ "imported": [], | ||
{ | ||
"uid": "3b45-7" | ||
"uid": "5d62-7" | ||
} | ||
] | ||
}, | ||
"3b45-7": { | ||
"5d62-7": { | ||
"id": "/packages/react-store/src/index.tsx", | ||
"moduleParts": { | ||
"index.production.js": "3b45-8" | ||
"index.production.js": "5d62-8" | ||
}, | ||
"imported": [ | ||
{ | ||
"uid": "3b45-9" | ||
"uid": "5d62-9" | ||
}, | ||
{ | ||
"uid": "3b45-5" | ||
"uid": "5d62-5" | ||
} | ||
@@ -73,3 +73,3 @@ ], | ||
}, | ||
"3b45-9": { | ||
"5d62-9": { | ||
"id": "use-sync-external-store/shim/with-selector", | ||
@@ -80,3 +80,3 @@ "moduleParts": {}, | ||
{ | ||
"uid": "3b45-7" | ||
"uid": "5d62-7" | ||
} | ||
@@ -83,0 +83,0 @@ ], |
@@ -49,10 +49,10 @@ /** | ||
this.state = this.options?.updateFn ? this.options.updateFn(previous)(updater) : updater(previous); | ||
this.#flush(previous); | ||
this.#flush(); | ||
}; | ||
#flush = previous => { | ||
#flush = () => { | ||
if (this.#batching) return; | ||
const flushId = ++this.#flushing; | ||
this.listeners.forEach(listener => { | ||
if (this.#flushing !== flushId || this.state === previous) return; | ||
listener(this.state, previous); | ||
if (this.#flushing !== flushId) return; | ||
listener(this.state); | ||
}); | ||
@@ -62,7 +62,6 @@ }; | ||
if (this.#batching) return cb(); | ||
const previous = this.state; | ||
this.#batching = true; | ||
cb(); | ||
this.#batching = false; | ||
this.#flush(previous); | ||
this.#flush(); | ||
}; | ||
@@ -69,0 +68,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,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})})); | ||
*/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()};#s=()=>{if(this.#t)return;const t=++this.#e;this.listeners.forEach((e=>{this.#e===t&&e(this.state)}))};batch=t=>{if(this.#t)return t();this.#t=!0,t(),this.#t=!1,this.#s()}},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.87", | ||
"version": "0.0.1-beta.88", | ||
"license": "MIT", | ||
@@ -39,3 +39,3 @@ "repository": "tanstack/react-store", | ||
"use-sync-external-store": "^1.2.0", | ||
"@tanstack/store": "0.0.1-beta.87" | ||
"@tanstack/store": "0.0.1-beta.88" | ||
}, | ||
@@ -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
164078
353
+ Added@tanstack/store@0.0.1-beta.88(transitive)
- Removed@tanstack/store@0.0.1-beta.87(transitive)