mirror of
https://github.com/stashapp/stash.git
synced 2026-01-08 16:49:21 +01:00
Fix tag delete (#690)
* Fix tag list delete button not working * Fix tags not refreshed when created/deleted
This commit is contained in:
parent
278be33618
commit
b465c36fc7
2 changed files with 21 additions and 19 deletions
|
|
@ -10,8 +10,8 @@ import { mutateMetadataAutoTag, useTagDestroy } from "src/core/StashService";
|
|||
import { useToast } from "src/hooks";
|
||||
import { FormattedNumber } from "react-intl";
|
||||
import { NavUtils } from "src/utils";
|
||||
import { Icon, Modal } from "src/components/Shared";
|
||||
import { TagCard } from "./TagCard";
|
||||
import { Icon, Modal } from "../Shared";
|
||||
|
||||
interface ITagList {
|
||||
filterHook?: (filter: ListFilterModel) => ListFilterModel;
|
||||
|
|
@ -60,20 +60,6 @@ export const TagList: React.FC<ITagList> = ({ filterHook }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const deleteAlert = (
|
||||
<Modal
|
||||
onHide={() => {}}
|
||||
show={!!deletingTag}
|
||||
icon="trash-alt"
|
||||
accept={{ onClick: onDelete, variant: "danger", text: "Delete" }}
|
||||
cancel={{ onClick: () => setDeletingTag(null) }}
|
||||
>
|
||||
<span>
|
||||
Are you sure you want to delete {deletingTag && deletingTag.name}?
|
||||
</span>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
function renderContent(
|
||||
result: FindTagsQueryResult,
|
||||
filter: ListFilterModel,
|
||||
|
|
@ -92,6 +78,20 @@ export const TagList: React.FC<ITagList> = ({ filterHook }) => {
|
|||
);
|
||||
}
|
||||
if (filter.displayMode === DisplayMode.List) {
|
||||
const deleteAlert = (
|
||||
<Modal
|
||||
onHide={() => {}}
|
||||
show={!!deletingTag}
|
||||
icon="trash-alt"
|
||||
accept={{ onClick: onDelete, variant: "danger", text: "Delete" }}
|
||||
cancel={{ onClick: () => setDeletingTag(null) }}
|
||||
>
|
||||
<span>
|
||||
Are you sure you want to delete {deletingTag && deletingTag.name}?
|
||||
</span>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
const tagElements = result.data.findTags.tags.map((tag) => {
|
||||
return (
|
||||
<div key={tag.id} className="tag-list-row row">
|
||||
|
|
|
|||
|
|
@ -334,23 +334,25 @@ export const tagMutationImpactedQueries = [
|
|||
"findSceneMarkers",
|
||||
"sceneMarkerTags",
|
||||
"allTags",
|
||||
"findTags",
|
||||
];
|
||||
|
||||
export const useTagCreate = (input: GQL.TagCreateInput) =>
|
||||
GQL.useTagCreateMutation({
|
||||
variables: input,
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter"],
|
||||
// update: () => StashService.invalidateQueries(StashService.tagMutationImpactedQueries)
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter", "FindTags"],
|
||||
update: () => invalidateQueries(tagMutationImpactedQueries),
|
||||
});
|
||||
export const useTagUpdate = (input: GQL.TagUpdateInput) =>
|
||||
GQL.useTagUpdateMutation({
|
||||
variables: input,
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter"],
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter", "FindTags"],
|
||||
update: () => invalidateQueries(tagMutationImpactedQueries),
|
||||
});
|
||||
export const useTagDestroy = (input: GQL.TagDestroyInput) =>
|
||||
GQL.useTagDestroyMutation({
|
||||
variables: input,
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter"],
|
||||
refetchQueries: ["AllTags", "AllTagsForFilter", "FindTags"],
|
||||
update: () => invalidateQueries(tagMutationImpactedQueries),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue