valdres 0.2.0-pre.2 → 0.2.0-pre.3

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/dist/index.js CHANGED
@@ -187,7 +187,7 @@ var isProd = () => {
187
187
 
188
188
  // src/lib/setValueInData.ts
189
189
  var setValueInData = (atom, value, data) => {
190
- if (isProd()) {
190
+ if (atom.mutable || isProd()) {
191
191
  data.values.set(atom, value);
192
192
  return value;
193
193
  } else {
@@ -1326,9 +1326,9 @@ var isFamilySelector = (state) => isFamilyState(state) && isSelector(state);
1326
1326
 
1327
1327
  // src/index.ts
1328
1328
  if (globalThis.__valdres__) {
1329
- throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${"0.2.0-pre.2"}`);
1329
+ throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${"0.2.0-pre.3"}`);
1330
1330
  } else {
1331
- globalThis.__valdres__ = "0.2.0-pre.2";
1331
+ globalThis.__valdres__ = "0.2.0-pre.3";
1332
1332
  }
1333
1333
  export {
1334
1334
  store,
@@ -10,5 +10,6 @@ export type Atom<Value = unknown> = {
10
10
  onSet?: AtomOnSet<Value>;
11
11
  onMount?: () => void | (() => void);
12
12
  maxAge?: number;
13
+ mutable?: boolean;
13
14
  staleWhileRevalidate?: number;
14
15
  };
@@ -5,5 +5,6 @@ export type AtomFamily<Value extends any, Args extends [any, ...any[]] = [any, .
5
5
  release: (...args: Args) => void;
6
6
  equal: EqualFunc<Value>;
7
7
  name?: string;
8
+ mutable?: boolean;
8
9
  __valdresAtomFamilyMap: Map<Value, AtomFamilyAtom<Value, Args>>;
9
10
  };
@@ -8,6 +8,7 @@ export type AtomOptions<Value = unknown> = {
8
8
  onSet?: AtomOnSet<Value>;
9
9
  onMount?: () => () => void;
10
10
  maxAge?: number;
11
+ mutable?: boolean;
11
12
  staleWhileRevalidate?: number;
12
13
  equal?: EqualFunc<Value>;
13
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valdres",
3
- "version": "0.2.0-pre.2",
3
+ "version": "0.2.0-pre.3",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Eigil Sagafos"