@tamagui/use-force-update
Advanced tools
Comparing version 1.0.0-beta.202 to 1.0.0-beta.203
@@ -26,22 +26,10 @@ var __defProp = Object.defineProperty; | ||
function useForceUpdate() { | ||
const setState = (0, import_react.useState)(0)[1]; | ||
const internal = (0, import_react.useRef)(); | ||
if (!internal.current) { | ||
internal.current = { | ||
isMounted: true, | ||
update: () => { | ||
if (internal.current.isMounted) { | ||
setState(Math.random()); | ||
} | ||
} | ||
}; | ||
} | ||
(0, import_react.useEffect)(() => { | ||
return () => { | ||
internal.current.isMounted = false; | ||
}; | ||
}, []); | ||
return internal.current.update; | ||
const [_, forceUpdate] = (0, import_react.useReducer)((x) => x + 1, 0); | ||
return forceUpdate; | ||
} | ||
__name(useForceUpdate, "useForceUpdate"); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
useForceUpdate | ||
}); | ||
//# sourceMappingURL=index.js.map |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
import { useEffect, useRef, useState } from "react"; | ||
import { useReducer } from "react"; | ||
function useForceUpdate() { | ||
const setState = useState(0)[1]; | ||
const internal = useRef(); | ||
if (!internal.current) { | ||
internal.current = { | ||
isMounted: true, | ||
update: () => { | ||
if (internal.current.isMounted) { | ||
setState(Math.random()); | ||
} | ||
} | ||
}; | ||
} | ||
useEffect(() => { | ||
return () => { | ||
internal.current.isMounted = false; | ||
}; | ||
}, []); | ||
return internal.current.update; | ||
const [_, forceUpdate] = useReducer((x) => x + 1, 0); | ||
return forceUpdate; | ||
} | ||
@@ -24,0 +8,0 @@ __name(useForceUpdate, "useForceUpdate"); |
var __defProp = Object.defineProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
import { useEffect, useRef, useState } from "react"; | ||
import { useReducer } from "react"; | ||
function useForceUpdate() { | ||
const setState = useState(0)[1]; | ||
const internal = useRef(); | ||
if (!internal.current) { | ||
internal.current = { | ||
isMounted: true, | ||
update: () => { | ||
if (internal.current.isMounted) { | ||
setState(Math.random()); | ||
} | ||
} | ||
}; | ||
} | ||
useEffect(() => { | ||
return () => { | ||
internal.current.isMounted = false; | ||
}; | ||
}, []); | ||
return internal.current.update; | ||
const [_, forceUpdate] = useReducer((x) => x + 1, 0); | ||
return forceUpdate; | ||
} | ||
@@ -24,0 +8,0 @@ __name(useForceUpdate, "useForceUpdate"); |
{ | ||
"name": "@tamagui/use-force-update", | ||
"version": "1.0.0-beta.202+a1a54793", | ||
"version": "1.0.0-beta.203+bdbb1f11", | ||
"typings": "types", | ||
@@ -19,5 +19,6 @@ "main": "dist/cjs", | ||
"devDependencies": { | ||
"@tamagui/build": "^1.0.0-beta.202+a1a54793" | ||
"@tamagui/build": "^1.0.0-beta.203+bdbb1f11", | ||
"react": "*" | ||
}, | ||
"dependencies": { | ||
"peerDependencies": { | ||
"react": "*" | ||
@@ -28,3 +29,3 @@ }, | ||
}, | ||
"gitHead": "a1a54793ee1890507fc934f42f2eb3a4020b57c5" | ||
"gitHead": "bdbb1f11fae44e3a78133373ef108adccaa68924" | ||
} |
@@ -1,2 +0,3 @@ | ||
export declare function useForceUpdate(): Function; | ||
/// <reference types="react" /> | ||
export declare function useForceUpdate(): import("react").DispatchWithoutAction; | ||
//# sourceMappingURL=index.d.ts.map |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
1
4844
2
59
- Removedreact@*