@tamagui/use-constant 1.129.4 → 1.129.5-1751174117974

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.
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(index_exports);
37
37
  var React = __toESM(require("react"));
38
38
  function useConstant(fn) {
39
39
  if (typeof document > "u") return React.useMemo(() => fn(), []);
40
- const ref = React.useRef();
40
+ const ref = React.useRef(void 0);
41
41
  return ref.current || (ref.current = {
42
42
  v: fn()
43
43
  }), ref.current.v;
package/dist/cjs/index.js CHANGED
@@ -29,7 +29,7 @@ var React = __toESM(require("react"));
29
29
  function useConstant(fn) {
30
30
  if (typeof document > "u")
31
31
  return React.useMemo(() => fn(), []);
32
- const ref = React.useRef();
32
+ const ref = React.useRef(void 0);
33
33
  return ref.current || (ref.current = { v: fn() }), ref.current.v;
34
34
  }
35
35
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB;AAEvC,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB,MAAS;AAEhD,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
5
5
  "names": []
6
6
  }
@@ -32,7 +32,7 @@ function useConstant(fn) {
32
32
  return React.useMemo(function() {
33
33
  return fn();
34
34
  }, []);
35
- var ref = React.useRef();
35
+ var ref = React.useRef(void 0);
36
36
  return ref.current || (ref.current = {
37
37
  v: fn()
38
38
  }), ref.current.v;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;YAAuB;AAIhB,SAASA,YAAeC,IAAW;AAExC,MAAI,OAAOC,WAAa;AACtB,WAAOC,MAAMC,QAAQ,WAAA;aAAMH,GAAAA;OAAM,CAAA,CAAE;AAGrC,MAAMI,MAAMF,MAAMG,OAAM;AAExB,SAAKD,IAAIE,YACPF,IAAIE,UAAU;IAAEC,GAAGP,GAAAA;EAAK,IAGnBI,IAAIE,QAAQC;AACrB;",
5
- "names": ["useConstant", "fn", "document", "React", "useMemo", "ref", "useRef", "current", "v"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;YAAuB;AAIhB,SAASA,YAAeC,IAAW;AAExC,MAAI,OAAOC,WAAa;AACtB,WAAOC,MAAMC,QAAQ,WAAA;aAAMH,GAAAA;OAAM,CAAA,CAAE;AAGrC,MAAMI,MAAMF,MAAMG,OAAqBC,MAAAA;AAEvC,SAAKF,IAAIG,YACPH,IAAIG,UAAU;IAAEC,GAAGR,GAAAA;EAAK,IAGnBI,IAAIG,QAAQC;AACrB;",
5
+ "names": ["useConstant", "fn", "document", "React", "useMemo", "ref", "useRef", "undefined", "current", "v"]
6
6
  }
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  function useConstant(fn) {
3
3
  if (typeof document > "u")
4
4
  return React.useMemo(() => fn(), []);
5
- const ref = React.useRef();
5
+ const ref = React.useRef(void 0);
6
6
  return ref.current || (ref.current = { v: fn() }), ref.current.v;
7
7
  }
8
8
  export {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,YAAY,WAAW;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB;AAEvC,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
4
+ "mappings": "AAAA,YAAY,WAAW;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB,MAAS;AAEhD,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
5
5
  "names": []
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  function useConstant(fn) {
3
3
  if (typeof document > "u") return React.useMemo(() => fn(), []);
4
- const ref = React.useRef();
4
+ const ref = React.useRef(void 0);
5
5
  return ref.current || (ref.current = {
6
6
  v: fn()
7
7
  }), ref.current.v;
@@ -1 +1 @@
1
- {"version":3,"names":["React","useConstant","fn","document","useMemo","ref","useRef","current","v"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIhB,SAASC,YAAeC,EAAA,EAAgB;EAE7C,IAAI,OAAOC,QAAA,GAAa,KACtB,OAAOH,KAAA,CAAMI,OAAA,CAAQ,MAAMF,EAAA,CAAG,GAAG,EAAE;EAGrC,MAAMG,GAAA,GAAML,KAAA,CAAMM,MAAA,CAAqB;EAEvC,OAAKD,GAAA,CAAIE,OAAA,KACPF,GAAA,CAAIE,OAAA,GAAU;IAAEC,CAAA,EAAGN,EAAA,CAAG;EAAE,IAGnBG,GAAA,CAAIE,OAAA,CAAQC,CAAA;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["React","useConstant","fn","document","useMemo","ref","useRef","current","v"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIhB,SAASC,YAAeC,EAAA,EAAgB;EAE7C,IAAI,OAAOC,QAAA,GAAa,KACtB,OAAOH,KAAA,CAAMI,OAAA,CAAQ,MAAMF,EAAA,CAAG,GAAG,EAAE;EAGrC,MAAMG,GAAA,GAAML,KAAA,CAAMM,MAAA,CAAqB,MAAS;EAEhD,OAAKD,GAAA,CAAIE,OAAA,KACPF,GAAA,CAAIE,OAAA,GAAU;IAAEC,CAAA,EAAGN,EAAA,CAAG;EAAE,IAGnBG,GAAA,CAAIE,OAAA,CAAQC,CAAA;AACrB","ignoreList":[]}
@@ -3,7 +3,7 @@ function useConstant(fn) {
3
3
  if (typeof document > "u") return React.useMemo(function () {
4
4
  return fn();
5
5
  }, []);
6
- var ref = React.useRef();
6
+ var ref = React.useRef(void 0);
7
7
  return ref.current || (ref.current = {
8
8
  v: fn()
9
9
  }), ref.current.v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-constant",
3
- "version": "1.129.4",
3
+ "version": "1.129.5-1751174117974",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "devDependencies": {
34
- "@tamagui/build": "1.129.4",
34
+ "@tamagui/build": "1.129.5-1751174117974",
35
35
  "react": "*"
36
36
  },
37
37
  "publishConfig": {
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@ export function useConstant<T>(fn: () => T): T {
8
8
  return React.useMemo(() => fn(), [])
9
9
  }
10
10
 
11
- const ref = React.useRef<ResultBox<T>>()
11
+ const ref = React.useRef<ResultBox<T>>(undefined)
12
12
 
13
13
  if (!ref.current) {
14
14
  ref.current = { v: fn() }
@@ -7,7 +7,7 @@
7
7
  "src/index.ts"
8
8
  ],
9
9
  "sourcesContent": [
10
- "import * as React from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n return React.useMemo(() => fn(), [])\n }\n\n const ref = React.useRef<ResultBox<T>>()\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"
10
+ "import * as React from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n return React.useMemo(() => fn(), [])\n }\n\n const ref = React.useRef<ResultBox<T>>(undefined)\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"
11
11
  ],
12
12
  "version": 3
13
13
  }