refresh macchneTree dopo eliminazione articolo-macchina
This commit is contained in:
parent
ba18adf21b
commit
20443de0ab
2 changed files with 12 additions and 0 deletions
|
|
@ -119,6 +119,7 @@ export default function ArticlesList() {
|
|||
setMovimentoArticle(null);
|
||||
fetchArticles();
|
||||
fetchGiacenze();
|
||||
window.dispatchEvent(new CustomEvent("articoli-updated"));
|
||||
};
|
||||
|
||||
const filteredArticles = articles.filter((article) => {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,17 @@ export default function MacchineTree() {
|
|||
loadInitialData();
|
||||
}, [loadInitialData]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleArticoliUpdated = () => {
|
||||
fetchArticoliPerMacchina();
|
||||
};
|
||||
|
||||
window.addEventListener("articoli-updated", handleArticoliUpdated);
|
||||
return () => {
|
||||
window.removeEventListener("articoli-updated", handleArticoliUpdated);
|
||||
};
|
||||
}, [fetchArticoliPerMacchina]);
|
||||
|
||||
const getParentStabilimento = (parentId: number | null): number | null => {
|
||||
if (!parentId) return null;
|
||||
const parent = nodes.find((n) => n.id === parentId);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue