Skip to content

fix: remove redundant taxonomy note update #3024

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

Merged
merged 1 commit into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ const LearningResourcePanels = ({
>
<LearningResourceTaxonomy
article={article}
updateNotes={updateNotes}
articleLanguage={articleLanguage}
hasTaxEntries={!!contexts?.length}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { sortBy } from "lodash-es";
import { memo } from "react";
import { useTranslation } from "react-i18next";
import { Spinner } from "@ndla/primitives";
import { IUpdatedArticleDTO, IArticleDTO } from "@ndla/types-backend/draft-api";
import { IArticleDTO } from "@ndla/types-backend/draft-api";
import { Metadata, NodeChild } from "@ndla/types-taxonomy";
import TaxonomyBlock from "./taxonomy/TaxonomyBlock";
import { useNodes } from "../../../../modules/nodes/nodeQueries";
Expand All @@ -20,7 +20,6 @@ import { useTaxonomyVersion } from "../../../StructureVersion/TaxonomyVersionPro

interface Props {
article: IArticleDTO;
updateNotes: (art: IUpdatedArticleDTO) => Promise<IArticleDTO>;
articleLanguage: string;
hasTaxEntries: boolean;
}
Expand All @@ -33,7 +32,7 @@ export interface MinimalNodeChild
metadata: Pick<Metadata, "visible">;
}

const LearningResourceTaxonomy = ({ article, updateNotes, articleLanguage, hasTaxEntries }: Props) => {
const LearningResourceTaxonomy = ({ article, articleLanguage, hasTaxEntries }: Props) => {
const { i18n } = useTranslation();
const { taxonomyVersion } = useTaxonomyVersion();

Expand Down Expand Up @@ -73,7 +72,6 @@ const LearningResourceTaxonomy = ({ article, updateNotes, articleLanguage, hasTa
subjects={subjectsQuery.data ?? []}
hasTaxEntries={hasTaxEntries}
resourceTypes={allResourceTypesQuery.data ?? []}
updateNotes={updateNotes}
article={article}
articleLanguage={articleLanguage}
versions={versionsQuery.data ?? []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useCallback, useMemo, useState, MouseEvent, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useQueryClient } from "@tanstack/react-query";
import { Button, SelectLabel, Text } from "@ndla/primitives";
import { IArticleDTO, IUpdatedArticleDTO } from "@ndla/types-backend/draft-api";
import { IArticleDTO } from "@ndla/types-backend/draft-api";
import {
Node,
NodeChild,
Expand Down Expand Up @@ -46,7 +46,6 @@ interface Props {
resourceTypes: ResourceType[];
article: IArticleDTO;
versions: Version[];
updateNotes: (art: IUpdatedArticleDTO) => Promise<IArticleDTO>;
articleLanguage: string;
}

Expand Down Expand Up @@ -104,7 +103,6 @@ const TaxonomyBlock = ({
resourceTypes,
versions,
article,
updateNotes,
articleLanguage,
}: Props) => {
const { t, i18n } = useTranslation();
Expand Down Expand Up @@ -264,12 +262,6 @@ const TaxonomyBlock = ({
originalNode: initialResource,
taxonomyVersion,
});
await updateNotes({
revision: article.revision,
notes: ["Oppdatert taksonomi."],
metaImage: undefined,
responsibleId: undefined,
});
await qc.invalidateQueries({
queryKey: nodeQueryKeys.nodes({
contentURI: `urn:article:${article.id}`,
Expand All @@ -282,13 +274,11 @@ const TaxonomyBlock = ({
},
[
article.id,
article.revision,
article.title?.title,
articleLanguage,
initialResource,
qc,
taxonomyVersion,
updateNotes,
updateTaxMutation,
workingResource,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { PageContent, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchThumb } from "@ndla/primitives";
import { styled } from "@ndla/styled-system/jsx";
import { IUpdatedArticleDTO, IArticleDTO } from "@ndla/types-backend/draft-api";
import { IArticleDTO } from "@ndla/types-backend/draft-api";
import TopicArticleContent from "./TopicArticleContent";
import TopicArticleTaxonomy from "./TopicArticleTaxonomy";
import FormAccordion from "../../../../components/Accordion/FormAccordion";
Expand Down Expand Up @@ -57,18 +57,11 @@ const StyledControls = styled("div", {
interface Props {
article?: IArticleDTO;
articleHistory: IArticleDTO[] | undefined;
updateNotes: (art: IUpdatedArticleDTO) => Promise<IArticleDTO>;
articleLanguage: string;
hasTaxonomyEntries: boolean;
}

const TopicArticleAccordionPanels = ({
article,
articleHistory,
updateNotes,
articleLanguage,
hasTaxonomyEntries,
}: Props) => {
const TopicArticleAccordionPanels = ({ article, articleHistory, articleLanguage, hasTaxonomyEntries }: Props) => {
const [hideComments, setHideComments] = useLocalStorageBooleanState(STORED_HIDE_COMMENTS);
const { t } = useTranslation();
const { userPermissions } = useSession();
Expand Down Expand Up @@ -117,7 +110,6 @@ const TopicArticleAccordionPanels = ({
>
<TopicArticleTaxonomy
article={article}
updateNotes={updateNotes}
articleLanguage={articleLanguage}
hasTaxEntries={hasTaxonomyEntries}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ const TopicArticleForm = ({
<TopicArticleAccordionPanels
articleLanguage={articleLanguage}
articleHistory={articleHistory?.data}
updateNotes={updateArticle}
article={article}
hasTaxonomyEntries={!!articleTaxonomy?.length}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { sortBy } from "lodash-es";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Spinner } from "@ndla/primitives";
import { IUpdatedArticleDTO, IArticleDTO } from "@ndla/types-backend/draft-api";
import { IArticleDTO } from "@ndla/types-backend/draft-api";
import { Node } from "@ndla/types-taxonomy";
import { ErrorMessage } from "@ndla/ui";
import TopicTaxonomyBlock from "./TopicTaxonomyBlock";
Expand All @@ -20,7 +20,6 @@ import { useTaxonomyVersion } from "../../../StructureVersion/TaxonomyVersionPro

type Props = {
article: IArticleDTO;
updateNotes: (art: IUpdatedArticleDTO) => Promise<IArticleDTO>;
articleLanguage: string;
hasTaxEntries: boolean;
};
Expand All @@ -41,7 +40,7 @@ const partitionByValidity = (nodes: Node[]) => {
return [validPlacements, invalidPlacements];
};

const TopicArticleTaxonomy = ({ article, updateNotes, articleLanguage, hasTaxEntries }: Props) => {
const TopicArticleTaxonomy = ({ article, articleLanguage, hasTaxEntries }: Props) => {
const { t } = useTranslation();
const { taxonomyVersion, changeVersion } = useTaxonomyVersion();
const versionsQuery = useVersions();
Expand Down Expand Up @@ -99,7 +98,6 @@ const TopicArticleTaxonomy = ({ article, updateNotes, articleLanguage, hasTaxEnt
versions={versionsQuery.data ?? []}
hasTaxEntries={hasTaxEntries}
articleLanguage={articleLanguage}
updateNotes={updateNotes}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useTranslation } from "react-i18next";
import { useQueryClient } from "@tanstack/react-query";
import { Button, ExpandableBox, ExpandableBoxSummary, SelectLabel, Text, UnOrderedList } from "@ndla/primitives";
import { styled } from "@ndla/styled-system/jsx";
import { IArticleDTO, IUpdatedArticleDTO } from "@ndla/types-backend/draft-api";
import { IArticleDTO } from "@ndla/types-backend/draft-api";
import { Node, Version } from "@ndla/types-taxonomy";
import TopicArticleConnections from "./TopicArticleConnections";
import { FormActionsContainer, FormContent } from "../../../../components/FormikForm";
Expand All @@ -38,7 +38,6 @@ interface Props {
validPlacements: Node[];
invalidPlacements: Node[];
articleLanguage: string;
updateNotes: (art: IUpdatedArticleDTO) => Promise<IArticleDTO>;
}

const StyledLi = styled("li", {
Expand All @@ -56,7 +55,6 @@ const TopicTaxonomyBlock = ({
nodes,
subjects: propSubjects,
articleLanguage,
updateNotes,
}: Props) => {
const { userPermissions } = useSession();
const { taxonomyVersion, changeVersion } = useTaxonomyVersion();
Expand Down Expand Up @@ -104,13 +102,6 @@ const TopicTaxonomyBlock = ({
articleId: article.id,
taxonomyVersion,
});
await updateNotes({
revision: article.revision,
language: article.title?.language,
notes: ["Oppdatert taksonomi."],
metaImage: undefined,
responsibleId: undefined,
});
await qc.invalidateQueries({
queryKey: nodeQueryKeys.nodes({
contentURI: `urn:article:${article.id}`,
Expand Down