mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove memoize-one from grafana-ui (#75016)
This commit is contained in:
parent
64dd8df441
commit
7b4536cb2f
@ -76,7 +76,6 @@
|
||||
"is-hotkey": "0.2.0",
|
||||
"jquery": "3.7.0",
|
||||
"lodash": "4.17.21",
|
||||
"memoize-one": "6.0.0",
|
||||
"micro-memoize": "^4.1.2",
|
||||
"moment": "2.29.4",
|
||||
"monaco-editor": "0.34.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { css } from '@emotion/css';
|
||||
import memoizeOne from 'memoize-one';
|
||||
import memoize from 'micro-memoize';
|
||||
import RCCascader from 'rc-cascader';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
@ -106,7 +106,7 @@ export class Cascader extends PureComponent<CascaderProps, CascaderState> {
|
||||
return selectOptions;
|
||||
};
|
||||
|
||||
getSearchableOptions = memoizeOne((options: CascaderOption[]) => this.flattenOptions(options));
|
||||
getSearchableOptions = memoize((options: CascaderOption[]) => this.flattenOptions(options));
|
||||
|
||||
setInitialValue(searchableOptions: Array<SelectableValue<string[]>>, initValue?: string) {
|
||||
if (!initValue) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Property } from 'csstype';
|
||||
import { clone } from 'lodash';
|
||||
import memoizeOne from 'memoize-one';
|
||||
import memoize from 'micro-memoize';
|
||||
import { Row } from 'react-table';
|
||||
|
||||
import {
|
||||
@ -137,7 +137,7 @@ export function getColumns(
|
||||
sortType: selectSortType(field.type),
|
||||
width: fieldTableOptions.width,
|
||||
minWidth: fieldTableOptions.minWidth ?? columnMinWidth,
|
||||
filter: memoizeOne(filterByValue(field)),
|
||||
filter: memoize(filterByValue(field)),
|
||||
justifyContent: getTextAlign(field),
|
||||
Footer: getFooterValue(fieldIndex, footerValues, isCountRowsSet),
|
||||
});
|
||||
|
@ -106,14 +106,17 @@ export function useStyles<T>(getStyles: (theme: GrafanaTheme) => T) {
|
||||
* Prefer using primitive values (boolean, number, string, etc) for
|
||||
* additional arguments for better performance
|
||||
*
|
||||
* ```
|
||||
* const getStyles = (theme, isDisabled, isOdd) => {css(...)}
|
||||
* [...]
|
||||
* const styles = useStyles2(getStyles, true, Boolean(index % 2))
|
||||
* ```
|
||||
*
|
||||
* NOTE: For memoization to work, ensure that all arguments don't change
|
||||
* across renders (or only change if they need to)
|
||||
*
|
||||
* @public
|
||||
* */
|
||||
/** @public */
|
||||
export function useStyles2<T extends unknown[], CSSReturnValue>(
|
||||
getStyles: (theme: GrafanaTheme2, ...args: T) => CSSReturnValue,
|
||||
...additionalArguments: T
|
||||
|
@ -1,4 +1,4 @@
|
||||
import memoizeOne from 'memoize-one';
|
||||
import memoize from 'micro-memoize';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -9,5 +9,5 @@ import memoizeOne from 'memoize-one';
|
||||
export function stylesFactory<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(
|
||||
stylesCreator: ResultFn
|
||||
) {
|
||||
return memoizeOne(stylesCreator);
|
||||
return memoize(stylesCreator);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user