dirk-cfx-react 1.1.54 → 1.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3817,9 +3817,25 @@ function cloneSettings(value) {
3817
3817
  var defaultOnClose = () => fetchNui("CLOSE_ADMIN_SECTION");
3818
3818
  function SettingsPanel(props) {
3819
3819
  const { open, onClose = defaultOnClose } = props;
3820
- const { store, updateSettings } = getScriptSettingsInstance();
3820
+ const { store, updateSettings, fetchSettings } = getScriptSettingsInstance();
3821
3821
  const [isSaving, setIsSaving] = react.useState(false);
3822
- if (!open) return null;
3822
+ const [loaded, setLoaded] = react.useState(false);
3823
+ react.useEffect(() => {
3824
+ if (!open) {
3825
+ setLoaded(false);
3826
+ return;
3827
+ }
3828
+ let cancelled = false;
3829
+ fetchSettings().then(() => {
3830
+ if (!cancelled) setLoaded(true);
3831
+ }).catch(() => {
3832
+ if (!cancelled) setLoaded(true);
3833
+ });
3834
+ return () => {
3835
+ cancelled = true;
3836
+ };
3837
+ }, [open]);
3838
+ if (!open || !loaded) return null;
3823
3839
  return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: settingsPanelQueryClient, children: /* @__PURE__ */ jsxRuntime.jsx(
3824
3840
  FormProvider,
3825
3841
  {
@@ -3831,6 +3847,7 @@ function SettingsPanel(props) {
3831
3847
  const result = await updateSettings(form.values);
3832
3848
  if (result?.success) {
3833
3849
  form.reinitialize(cloneSettings(form.values));
3850
+ settingsPanelQueryClient.invalidateQueries({ queryKey: ["scriptSettingsHistory"] });
3834
3851
  return;
3835
3852
  }
3836
3853
  form.reinitialize(cloneSettings(store.getState()));