@quanta-lib/q-state 1.1.2 → 1.1.4

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/README.md CHANGED
@@ -1,12 +1,16 @@
1
1
  # Q-State
2
2
 
3
- A lightweight React state management library using `useSyncExternalStore` with optional localStorage caching and value transformation.
3
+ A lightweight React state management engine using `useSyncExternalStore` with optional localStorage caching and value transformation.
4
+ Hey i have an isssue, when you use nextjs with this library, just copy the engine code in the q-state file
5
+ because this library had hydration issue, after you copy it, use it inside your src file, so this library can work
6
+ well in nextjs, im sorry for that...
4
7
 
5
8
  ## Installation
6
9
 
7
10
  ```bash
8
11
  npm install @quanta-lib/q-state
9
-
12
+ ```
13
+ ```typescript
10
14
  ## Features
11
15
 
12
16
  - **Type-safe state management** - Full TypeScript support with generic types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quanta-lib/q-state",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "A lightweight React state management library using `useSyncExternalStore` with optional localStorage caching and value transformation.",
5
5
  "main": "dist/Q-State-Engine.js",
6
6
  "types": "src/Q-State-Engine.ts",
@@ -55,19 +55,10 @@ useQuantaState = <K extends keyof T>(key: K): [T[K]] => {
55
55
  }
56
56
  return this.obj[key]
57
57
  }
58
- let isHydrated = false
59
58
  const defaultValue = null
60
59
  const syncSpecificData = useSyncExternalStore(
61
60
  this.subsribe,
62
- () => {
63
- if (!isHydrated) {
64
- if (typeof window !== 'undefined') {
65
- setTimeout(() => { isHydrated = true }, 0);
66
- }
67
- return defaultValue
68
- }
69
- return getCurrAfterRender()
70
- },
61
+ () => getCurrAfterRender(),
71
62
  () => defaultValue
72
63
  )
73
64
  return [syncSpecificData] as [T[K]]