Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add memoize util compat #31800

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @fluentui/react-utilities-compat

**React Utilities components for [Fluent UI React](https://react.fluentui.dev/)**
**React compatibility utilities for [Fluent UI React](https://react.fluentui.dev/)**

This package contains utility functions ported from Fluent UI React v8.
This allows developers with high usage of v8 utility functions to migrate to v9.

The utility functions are ported as-is with no improvements. Internal dependencies on v8 are ported into the internals folder and are only exported from the package if the utility function signature includes them.

Utility functions that will not be available in future major versions of Fluent UI React are marked as deprecated. We encourage developers to move off of ported utility functions whether they are deprecated or not. Developers should consider using utility functions available from javascript, node, or from open-source libraries; bringing the utility function into their own repository; or rewriting code to not use the utility function.

Any utility functions that exist in v8 and already exist in v9 will be exported from their respective v9 component or the v9 react-utilities package.

If a v8 utility is not exported from this package that you require, please contact the Fluent team.

These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

```ts

// @public @deprecated (undocumented)
export function memoizeFunction<T extends (...args: any[]) => RetType, RetType>(cb: T, maxCacheSize?: number, ignoreNullOrUndefinedResult?: boolean): T;

// (No @packageDocumentation comment for this package)

```
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export {};
/* eslint-disable deprecation/deprecation */
export { createMemoizer, memoize, memoizeFunction, setMemoizeWeakMap, resetMemoizations } from './memoize';
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/naming-convention */
import type { IRawStyleBase } from './IRawStyleBase';
import type { IStyle } from './IStyle';

/**
* IRawStyle extends a raw style object, but allows selectors to be defined
* under the selectors node.
* @public
* {@docCategory IRawStyle}
*/

export interface IRawStyle extends IRawStyleBase {
/**
* Allow css variables, strings, objects. While we should have more strict typing
* here, partners are broken in many unpredictable cases where typescript can't infer
* the right typing. Loosening the typing to both allow for css variables and other things.
*/
[key: string]: any;

/**
* Display name for the style.
*/
displayName?: string;

/**
* @deprecated - The selectors wrapper is no longer required. You may add selectors as siblings to other
* style properties, like most css-in-js libraries support.
*/
selectors?: {
[key: string]: IStyle;
};
}
Loading
Loading