@fluentui/react-utilities
Advanced tools
Comparing version 9.0.0-alpha.1 to 9.0.0-alpha.2
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Wed, 24 Feb 2021 00:02:34 GMT", | ||
"date": "Thu, 25 Feb 2021 01:11:31 GMT", | ||
"tag": "@fluentui/react-utilities_v9.0.0-alpha.2", | ||
"version": "9.0.0-alpha.2", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"comment": "Remove dep array from useEventCallback", | ||
"author": "lingfan.gao@microsoft.com", | ||
"commit": "f8aad9bd5f65b102478944d69e841b37a19d0599", | ||
"package": "@fluentui/react-utilities" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 24 Feb 2021 00:05:29 GMT", | ||
"tag": "@fluentui/react-utilities_v9.0.0-alpha.1", | ||
@@ -8,0 +23,0 @@ "version": "9.0.0-alpha.1", |
# Change Log - @fluentui/react-utilities | ||
This log was last generated on Wed, 24 Feb 2021 00:02:34 GMT and should not be manually modified. | ||
This log was last generated on Thu, 25 Feb 2021 01:11:31 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [9.0.0-alpha.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.2) | ||
Thu, 25 Feb 2021 01:11:31 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-alpha.1..@fluentui/react-utilities_v9.0.0-alpha.2) | ||
### Changes | ||
- Remove dep array from useEventCallback ([PR #17113](https://github.com/microsoft/fluentui/pull/17113) by lingfan.gao@microsoft.com) | ||
## [9.0.0-alpha.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-alpha.1) | ||
Wed, 24 Feb 2021 00:02:34 GMT | ||
Wed, 24 Feb 2021 00:05:29 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v0.4.0..@fluentui/react-utilities_v9.0.0-alpha.1) | ||
@@ -11,0 +20,0 @@ |
@@ -143,2 +143,17 @@ import * as React from 'react'; | ||
/** | ||
* https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | ||
* | ||
* Modified `useCallback` that can be used when dependencies change too frequently. Can occur when | ||
* e.g. user props are depedencies which could change on every render | ||
* e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently | ||
* | ||
* This should not be used often, but can be a useful re-render optimization since the callback is a ref and | ||
* will not be invalidated between rerenders | ||
* | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return; | ||
/** | ||
* Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library). | ||
@@ -145,0 +160,0 @@ * |
@@ -97,2 +97,5 @@ ## API Report File for "@fluentui/react-utilities" | ||
// @public | ||
export const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return; | ||
// @public | ||
export function useId(prefix?: string, providedId?: string): string; | ||
@@ -99,0 +102,0 @@ |
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
export * from './useId'; | ||
export * from './useMergedRefs'; | ||
export * from './useConst'; | ||
export * from './useId'; |
@@ -1,10 +0,11 @@ | ||
define(["require", "exports", "tslib", "./useBoolean", "./useControllableValue", "./useMergedRefs", "./useConst", "./useId"], function (require, exports, tslib_1, useBoolean_1, useControllableValue_1, useMergedRefs_1, useConst_1, useId_1) { | ||
define(["require", "exports", "tslib", "./useBoolean", "./useConst", "./useControllableValue", "./useEventCallback", "./useId", "./useMergedRefs"], function (require, exports, tslib_1, useBoolean_1, useConst_1, useControllableValue_1, useEventCallback_1, useId_1, useMergedRefs_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
tslib_1.__exportStar(useBoolean_1, exports); | ||
tslib_1.__exportStar(useConst_1, exports); | ||
tslib_1.__exportStar(useControllableValue_1, exports); | ||
tslib_1.__exportStar(useEventCallback_1, exports); | ||
tslib_1.__exportStar(useId_1, exports); | ||
tslib_1.__exportStar(useMergedRefs_1, exports); | ||
tslib_1.__exportStar(useConst_1, exports); | ||
tslib_1.__exportStar(useId_1, exports); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as React from 'react'; | ||
/** | ||
@@ -12,5 +11,5 @@ * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return, dependencies: React.DependencyList) => (...args: Args) => Return; | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return; |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "tslib", "react"], function (require, exports, tslib_1, React) { | ||
define(["require", "exports", "react"], function (require, exports, React) { | ||
"use strict"; | ||
@@ -14,6 +14,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
exports.useEventCallback = function (fn, dependencies) { | ||
exports.useEventCallback = function (fn) { | ||
var callbackRef = React.useRef(function () { | ||
@@ -24,3 +24,3 @@ throw new Error('Cannot call an event handler while rendering'); | ||
callbackRef.current = fn; | ||
}, tslib_1.__spreadArrays([fn], dependencies)); | ||
}, [fn]); | ||
return React.useCallback(function () { | ||
@@ -27,0 +27,0 @@ var args = []; |
define(["require", "exports", "@fluentui/set-version"], function (require, exports, set_version_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
set_version_1.setVersion('@fluentui/react-utilities', '9.0.0-alpha.1'); | ||
set_version_1.setVersion('@fluentui/react-utilities', '9.0.0-alpha.2'); | ||
}); | ||
//# sourceMappingURL=version.js.map |
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
export * from './useId'; | ||
export * from './useMergedRefs'; | ||
export * from './useConst'; | ||
export * from './useId'; |
@@ -5,6 +5,7 @@ "use strict"; | ||
tslib_1.__exportStar(require("./useBoolean"), exports); | ||
tslib_1.__exportStar(require("./useConst"), exports); | ||
tslib_1.__exportStar(require("./useControllableValue"), exports); | ||
tslib_1.__exportStar(require("./useEventCallback"), exports); | ||
tslib_1.__exportStar(require("./useId"), exports); | ||
tslib_1.__exportStar(require("./useMergedRefs"), exports); | ||
tslib_1.__exportStar(require("./useConst"), exports); | ||
tslib_1.__exportStar(require("./useId"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as React from 'react'; | ||
/** | ||
@@ -12,5 +11,5 @@ * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return, dependencies: React.DependencyList) => (...args: Args) => Return; | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var React = require("react"); | ||
@@ -15,6 +14,6 @@ /** | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
exports.useEventCallback = function (fn, dependencies) { | ||
exports.useEventCallback = function (fn) { | ||
var callbackRef = React.useRef(function () { | ||
@@ -25,3 +24,3 @@ throw new Error('Cannot call an event handler while rendering'); | ||
callbackRef.current = fn; | ||
}, tslib_1.__spreadArrays([fn], dependencies)); | ||
}, [fn]); | ||
return React.useCallback(function () { | ||
@@ -28,0 +27,0 @@ var args = []; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var set_version_1 = require("@fluentui/set-version"); | ||
set_version_1.setVersion('@fluentui/react-utilities', '9.0.0-alpha.1'); | ||
set_version_1.setVersion('@fluentui/react-utilities', '9.0.0-alpha.2'); | ||
//# sourceMappingURL=version.js.map |
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
export * from './useId'; | ||
export * from './useMergedRefs'; | ||
export * from './useConst'; | ||
export * from './useId'; |
export * from './useBoolean'; | ||
export * from './useConst'; | ||
export * from './useControllableValue'; | ||
export * from './useEventCallback'; | ||
export * from './useId'; | ||
export * from './useMergedRefs'; | ||
export * from './useConst'; | ||
export * from './useId'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as React from 'react'; | ||
/** | ||
@@ -12,5 +11,5 @@ * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return, dependencies: React.DependencyList) => (...args: Args) => Return; | ||
export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...args: Args) => Return) => (...args: Args) => Return; |
@@ -1,2 +0,1 @@ | ||
import { __spreadArrays } from "tslib"; | ||
import * as React from 'react'; | ||
@@ -13,6 +12,6 @@ /** | ||
* | ||
* @param fn The callback function that will be used | ||
* @param dependencies Shouldn't be needed since the callback is ref based, but good to behave like native | ||
* @param fn - The callback function that will be used | ||
* @param dependencies - Shouldn't be needed since the callback is ref based, but good to behave like native | ||
*/ | ||
export var useEventCallback = function (fn, dependencies) { | ||
export var useEventCallback = function (fn) { | ||
var callbackRef = React.useRef(function () { | ||
@@ -23,3 +22,3 @@ throw new Error('Cannot call an event handler while rendering'); | ||
callbackRef.current = fn; | ||
}, __spreadArrays([fn], dependencies)); | ||
}, [fn]); | ||
return React.useCallback(function () { | ||
@@ -26,0 +25,0 @@ var args = []; |
// Do not modify this file; it is generated as part of publish. | ||
// The checked in version is a placeholder only and will not be updated. | ||
import { setVersion } from '@fluentui/set-version'; | ||
setVersion('@fluentui/react-utilities', '9.0.0-alpha.1'); | ||
setVersion('@fluentui/react-utilities', '9.0.0-alpha.2'); | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@fluentui/react-utilities", | ||
"version": "9.0.0-alpha.1", | ||
"version": "9.0.0-alpha.2", | ||
"description": "A set of general React-specific utilities.", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
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
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
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
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
242643
2565