frontend-plugin-api: swtich IconApi.listIconKeys to return an array direcly instead
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -122,10 +122,8 @@ function LegacyAppContextProvider(props: { children: ReactNode }) {
|
||||
},
|
||||
|
||||
getSystemIcons(): Record<string, IconComponent> {
|
||||
const { keys } = iconsApi.listIconKeys();
|
||||
|
||||
return Object.fromEntries(
|
||||
Array.from(keys).map(key => [key, iconsApi.getIcon(key)!]),
|
||||
iconsApi.listIconKeys().map(key => [key, iconsApi.getIcon(key)!]),
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@ export class DefaultIconsApi implements IconsApi {
|
||||
return this.#icons.get(key);
|
||||
}
|
||||
|
||||
listIconKeys: IconsApi['listIconKeys'] = () => {
|
||||
return { keys: this.#icons.keys() };
|
||||
};
|
||||
listIconKeys(): string[] {
|
||||
return Array.from(this.#icons.keys());
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { DefaultIconsApi } from './IconsApi';
|
||||
export { DefaultIconsApi } from './DefaultIconsApi';
|
||||
|
||||
@@ -981,9 +981,7 @@ export interface IconsApi {
|
||||
// (undocumented)
|
||||
getIcon(key: string): IconComponent | undefined;
|
||||
// (undocumented)
|
||||
listIconKeys(): {
|
||||
keys: Iterable<string>;
|
||||
};
|
||||
listIconKeys(): string[];
|
||||
}
|
||||
|
||||
// @public
|
||||
|
||||
@@ -25,7 +25,7 @@ import { IconComponent } from '../../icons';
|
||||
export interface IconsApi {
|
||||
getIcon(key: string): IconComponent | undefined;
|
||||
|
||||
listIconKeys(): { keys: Iterable<string> };
|
||||
listIconKeys(): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user