Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: save resources on reload (#3235)

Bogdan Chadkinb8b3e5c7d216
diff --git a/apps/builder/app/builder/features/settings-panel/variable-popover.tsx b/apps/builder/app/builder/features/settings-panel/variable-popover.tsx
index 37f0282874..186b31fec8 100644
--- a/apps/builder/app/builder/features/settings-panel/variable-popover.tsx
+++ b/apps/builder/app/builder/features/settings-panel/variable-popover.tsx
@@ -625,7 +625,18 @@ export const VariablePopoverTrigger = forwardRef<
prefix={<RefreshIcon />}
color="ghost"
disabled={areResourcesLoading}
- onClick={() => invalidateResource(variable.resourceId)}
+ onClick={() => {
+ if (panelRef.current) {
+ if (panelRef.current.allErrorsVisible === false) {
+ panelRef.current.showAllErrors();
+ return;
+ }
+ if (panelRef.current.valid) {
+ panelRef.current.save();
+ }
+ }
+ invalidateResource(variable.resourceId);
+ }}
/>
</Tooltip>
</>
diff --git a/apps/builder/app/shared/nano-states/props.ts b/apps/builder/app/shared/nano-states/props.ts
index 0d606dceb1..5ea8f1d278 100644
--- a/apps/builder/app/shared/nano-states/props.ts
+++ b/apps/builder/app/shared/nano-states/props.ts
@@ -559,10 +559,6 @@ export const subscribeResources = () => {
}
}
- if (missing.size === 0) {
- return;
- }
-
// preset undefined to prevent loading already requested data
for (const request of missing.values()) {
const cacheKey = JSON.stringify(request);