mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-25 09:05:21 +02:00
fix: clear stale tag filter when tags are deleted
Remove deleted tag IDs from the selected filter state when the available tags list changes.
This commit is contained in:
@@ -98,6 +98,15 @@ export const ShowProjects = () => {
|
||||
localStorage.setItem("projectsTagFilter", JSON.stringify(selectedTagIds));
|
||||
}, [selectedTagIds]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!availableTags) return;
|
||||
const validIds = new Set(availableTags.map((t) => t.tagId));
|
||||
setSelectedTagIds((prev) => {
|
||||
const filtered = prev.filter((id) => validIds.has(id));
|
||||
return filtered.length === prev.length ? prev : filtered;
|
||||
});
|
||||
}, [availableTags]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!router.isReady) return;
|
||||
const urlQuery = typeof router.query.q === "string" ? router.query.q : "";
|
||||
|
||||
Reference in New Issue
Block a user