Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/taxonomy/data/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const apiUrls = {
/** URL to plan (preview what would happen) a taxonomy import */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's plenty of horizontal space here. Could we make the text input wider, so that it's more often able to show the whole tag during editing?

Fine to ticket up for a followup PR if you'd rather do that.

View:
Screenshot 2026-03-31 at 10 14 15 AM

Edit:
Screenshot 2026-03-31 at 10 15 25 AM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Good catch.
Added it to openedx/modular-learning#256

tagsPlanImport: (taxonomyId: number) => makeUrl(`${taxonomyId}/tags/import/plan/`),
createTag: (taxonomyId: number) => makeUrl(`${taxonomyId}/tags/`),
updateTag: (taxonomyId: number) => makeUrl(`${taxonomyId}/tags/`),
} satisfies Record<string, (...args: any[]) => string>;

/**
Expand Down
24 changes: 24 additions & 0 deletions src/taxonomy/data/apiHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,27 @@ export const useCreateTag = (taxonomyId: number) => {
},
});
};

export const useUpdateTag = (taxonomyId: number) => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: async ({ value, originalValue }: { value: string, originalValue: string }) => {
try {
await getAuthenticatedHttpClient().patch(
apiUrls.updateTag(taxonomyId),
{ tag: originalValue, updated_tag_value: value },
);
} catch (err) {
throw new Error(getApiErrorMessage(err));
}
},
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: taxonomyQueryKeys.taxonomyTagList(taxonomyId),
});
// In the metadata, 'tagsCount' (and possibly other fields) will have changed:
queryClient.invalidateQueries({ queryKey: taxonomyQueryKeys.taxonomyMetadata(taxonomyId) });
},
});
};
1 change: 1 addition & 0 deletions src/taxonomy/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface TagListData {
next: string;
numPages: number;
previous: string;
canAddTag?: boolean;
results: TagData[];
start: number;
}
Loading
Loading