New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@khanacademy/wonder-blocks-core

Package Overview
Dependencies
Maintainers
0
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/wonder-blocks-core - npm Package Compare versions

Comparing version 0.0.0-PR2413-20241220200626 to 0.0.0-PR2414-20241220221259

6

CHANGELOG.md
# @khanacademy/wonder-blocks-core
## 0.0.0-PR2413-20241220200626
## 0.0.0-PR2414-20241220221259
### Minor Changes
### Patch Changes
- c0e547e6: Update useOnMountEffect to pass isMountedRef to callback
- 11a0f5c6: No functional changes. Adding prepublishOnly script.

@@ -9,0 +9,0 @@ ## 11.0.0

@@ -294,10 +294,3 @@ import _extends from '@babel/runtime/helpers/extends';

const useOnMountEffect = callback => {
const isMountedRef = React.useRef(true);
React.useEffect(() => {
const cleanup = callback(isMountedRef);
return () => {
cleanup == null ? void 0 : cleanup();
isMountedRef.current = false;
};
}, []);
React.useEffect(callback, []);
};

@@ -304,0 +297,0 @@

@@ -1,2 +0,1 @@

import * as React from "react";
/**

@@ -7,3 +6,3 @@ * Runs a callback once on mount.

*
* @param {(isMountedRef: React.MutableRefObject<boolean>) => void | (() => void)} callback function that forces the component to update.
* @param {() => (void | (() => void))} callback function that forces the component to update.
*

@@ -30,24 +29,3 @@ * The following code snippets are equivalent

* If you only need to do something on mount, don't return a cleanup function from `callback`.
*
* If your callback is async, use the `isMountedRef` ref that's passed to the callback to ensure
* that the component using `useOnMountEffect` hasn't been unmounted, e.g.
*
* ```
* const MyComponent = () => {
* const [foo, setFoo] = React.useState("");
* useOnMountEffect((isMountedRef) => {
* const action = async () => {
* const res = await fetch("/foo");
* const text = res.text();
* if (isMountedRef.current) {
* setFoo(text);
* }
* }
*
* action();
* });
*
* return foo !== "" ? <h1>Loading...</h1> : <h1>{foo}</h1>;
* }
*/
export declare const useOnMountEffect: (callback: (isMountedRef: React.MutableRefObject<boolean>) => void | (() => void)) => void;
export declare const useOnMountEffect: (callback: () => void | (() => void)) => void;

@@ -321,10 +321,3 @@ 'use strict';

const useOnMountEffect = callback => {
const isMountedRef = React__namespace.useRef(true);
React__namespace.useEffect(() => {
const cleanup = callback(isMountedRef);
return () => {
cleanup == null ? void 0 : cleanup();
isMountedRef.current = false;
};
}, []);
React__namespace.useEffect(callback, []);
};

@@ -331,0 +324,0 @@

{
"name": "@khanacademy/wonder-blocks-core",
"version": "0.0.0-PR2413-20241220200626",
"version": "0.0.0-PR2414-20241220221259",
"design": "v1",

@@ -13,3 +13,4 @@ "publishConfig": {

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
},

@@ -28,3 +29,3 @@ "dependencies": {

"@khanacademy/wb-dev-build-settings": "^2.0.0",
"@khanacademy/wonder-blocks-testing-core": "^2.0.0"
"@khanacademy/wonder-blocks-testing-core": "0.0.0-PR2414-20241220221259"
},

@@ -31,0 +32,0 @@ "author": "",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc