mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-08 12:24:45 +00:00
fix(ui): stop the add-provider modal from shifting while it loads (#13179)
This commit is contained in:
1 parent
75c9a6bf51
commit
dcd3d5a0fb
22 files changed
+799
-151
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
interface LighthouseLlmStoreState {
|
||||
// Last answer this page load (null: never checked), shown at once on reopen.
|
||||
hasConnectedLlm: boolean | null;
|
||||
// Id of the newest check: an older check that answers late is ignored.
|
||||
latestCheck: number;
|
||||
startCheck: () => number;
|
||||
settleCheck: (check: number, hasConnectedLlm: boolean) => void;
|
||||
}
|
||||
|
||||
export const useLighthouseLlmStore = create<LighthouseLlmStoreState>(
|
||||
(set, get) => ({
|
||||
hasConnectedLlm: null,
|
||||
latestCheck: 0,
|
||||
startCheck: () => {
|
||||
const check = get().latestCheck + 1;
|
||||
set({ latestCheck: check });
|
||||
return check;
|
||||
},
|
||||
settleCheck: (check, hasConnectedLlm) => {
|
||||
if (check === get().latestCheck) set({ hasConnectedLlm });
|
||||
},
|
||||
}),
|
||||
);
|
||||
Reference in new issue
Block a user