mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 00:40:58 +01:00
fix: issue with category removal and ready state (#129)
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import type { PropsWithChildren } from "react";
|
||||
import { createContext, useCallback, useContext, useState } from "react";
|
||||
import {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
import type { RouterOutputs } from "@homarr/api";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
@@ -24,6 +30,15 @@ export const BoardProvider = ({
|
||||
refetchOnReconnect: false,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setReadySections((previous) =>
|
||||
previous.filter((id) =>
|
||||
data.sections.some((section) => section.id === id),
|
||||
),
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [data.sections.length, setReadySections]);
|
||||
|
||||
const markAsReady = useCallback((id: string) => {
|
||||
setReadySections((previous) =>
|
||||
previous.includes(id) ? previous : [...previous, id],
|
||||
|
||||
Reference in New Issue
Block a user