diff --git a/adminSiteClient/ChartEditorPage.tsx b/adminSiteClient/ChartEditorPage.tsx index 36ec12bab1..093262f62b 100644 --- a/adminSiteClient/ChartEditorPage.tsx +++ b/adminSiteClient/ChartEditorPage.tsx @@ -159,6 +159,17 @@ export class ChartEditorPage this.refresh() } + componentDidUpdate( + prevProps: Readonly<{ + grapherId?: number + grapherConfig?: GrapherInterface + }> + ): void { + if (prevProps.grapherId !== this.props.grapherId) { + void this.fetchTags() + } + } + render(): React.ReactElement { return } diff --git a/adminSiteClient/EditorBasicTab.tsx b/adminSiteClient/EditorBasicTab.tsx index 5f624b2acf..00262ef334 100644 --- a/adminSiteClient/EditorBasicTab.tsx +++ b/adminSiteClient/EditorBasicTab.tsx @@ -360,11 +360,12 @@ class VariablesSection< // eslint-disable-next-line react-refresh/only-export-components const TagsSection = (props: { chartId: number | undefined - editor: ChartEditor + tags: DbChartTagJoin[] | undefined + availableTags: DbChartTagJoin[] | undefined onSaveTags: (tags: DbChartTagJoin[]) => void }) => { - const { tags, availableTags } = props.editor - const canTag = !!props.chartId && tags && availableTags + const { chartId, tags, availableTags } = props + const canTag = !!chartId && tags && availableTags return ( {canTag ? ( @@ -386,7 +387,10 @@ const TagsSection = (props: { > ) : ( - Can't tag this chart. Maybe it hasn't been saved yet? + + Can't tag this chart + {!chartId && <>, because it hasn't been saved yet>}. + )} ) @@ -553,7 +557,8 @@ export class EditorBasicTab< {isChartEditorInstance(editor) && ( )}
Can't tag this chart. Maybe it hasn't been saved yet?
+ Can't tag this chart + {!chartId && <>, because it hasn't been saved yet>}. +