addon render function are now called like React elements, thus keys are no longer needed.

This is not a breaking change, just logs a warning from react as far as i can see
This commit is contained in:
Norbert de Langen 2023-07-11 13:46:10 +02:00
parent 36f4a7a1da
commit 9f79059cce
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762
6 changed files with 9 additions and 9 deletions

View File

@ -36,8 +36,8 @@ addons.register(ADDON_ID, (api) => {
addons.add(PANEL_ID, {
title: Title,
type: types.PANEL,
render: ({ active = true, key }) => (
<A11yContextProvider key={key} active={active}>
render: ({ active = true }) => (
<A11yContextProvider active={active}>
<A11YPanel />
</A11yContextProvider>
),

View File

@ -36,7 +36,7 @@ addons.register(ADDON_ID, (api) => {
addons.add(PANEL_ID, {
title: Title,
type: types.PANEL,
render: ({ active, key }) => <ActionLogger key={key} api={api} active={!!active} />,
render: ({ active }) => <ActionLogger api={api} active={!!active} />,
paramKey: PARAM_KEY,
});
});

View File

@ -26,12 +26,12 @@ addons.register(ADDON_ID, (api) => {
title: Title,
type: types.PANEL,
paramKey: PARAM_KEY,
render: ({ key, active }) => {
render: ({ active }) => {
if (!active || !api.getCurrentStoryData()) {
return null;
}
return (
<AddonPanel key={key} active={active}>
<AddonPanel active={active}>
<ControlsPanel />
</AddonPanel>
);

View File

@ -29,7 +29,7 @@ addons.register(ADDON_ID, (api) => {
type: types.PANEL,
title: Title,
match: ({ viewMode }) => viewMode === 'story',
render: ({ key, active }) => {
render: ({ active }) => {
const newLocal = useCallback(({ state }: Combo) => {
return {
storyId: state.storyId,
@ -37,7 +37,7 @@ addons.register(ADDON_ID, (api) => {
}, []);
return (
<AddonPanel key={key} active={active}>
<AddonPanel active={active}>
<Consumer filter={newLocal}>{({ storyId }) => <Panel storyId={storyId} />}</Consumer>
</AddonPanel>
);

View File

@ -8,7 +8,7 @@ addons.register(ADDON_ID, (api) => {
addons.add(PANEL_ID, {
title: 'Tests',
type: types.PANEL,
render: ({ active, key }) => <Panel key={key} api={api} active={active} />,
render: ({ active }) => <Panel api={api} active={active} />,
paramKey: PARAM_KEY,
});
});

View File

@ -8,7 +8,7 @@ addons.register(ADDON_ID, (api) => {
addons.add(PANEL_ID, {
type: types.PANEL,
title: 'Code',
render: ({ active, key }) => (active ? <StoryPanel key={key} api={api} /> : null),
render: ({ active }) => (active ? <StoryPanel api={api} /> : null),
paramKey: 'storysource',
});
});