Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions apps/builder/app/shared/nano-states/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { uploadingFileDataToAsset } from "~/builder/shared/assets/asset-utils";
import { fetch } from "~/shared/fetch.client";
import { $selectedPage, getInstanceKey } from "../awareness";
import { computeExpression } from "../data-variables";
import { $currentSystem, $currentSystemVariableId } from "../system";
import { $currentSystem } from "../system";

export const assetBaseUrl = "/cgi/asset/";

Expand Down Expand Up @@ -168,14 +168,10 @@ const $unscopedVariableValues = computed(
* circular updates
*/
const $loaderVariableValues = computed(
[
$dataSources,
$dataSourceVariables,
$currentSystemVariableId,
$currentSystem,
],
(dataSources, dataSourceVariables, systemVariableId, system) => {
[$dataSources, $dataSourceVariables, $selectedPage, $currentSystem],
(dataSources, dataSourceVariables, selectedPage, system) => {
const values = new Map<string, unknown>();
values.set(SYSTEM_VARIABLE_ID, system);
for (const [dataSourceId, dataSource] of dataSources) {
if (dataSource.type === "variable") {
values.set(
Expand All @@ -185,7 +181,7 @@ const $loaderVariableValues = computed(
}
if (dataSource.type === "parameter") {
let value = dataSourceVariables.get(dataSourceId);
if (dataSource.id === systemVariableId) {
if (dataSource.id === selectedPage?.systemDataSourceId) {
value = system;
}
values.set(dataSourceId, value);
Expand Down
6 changes: 0 additions & 6 deletions apps/builder/app/shared/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import { $selectedPage } from "./awareness";
import { $pages, $publishedOrigin } from "./nano-states";
import { serverSyncStore } from "./sync";

export const $currentSystemVariableId = computed(
$selectedPage,
// fallback to global system variable
(page) => page?.systemDataSourceId ?? SYSTEM_VARIABLE_ID
);

export const $systemDataByPage = atom(
new Map<Page["id"], Pick<System, "search" | "params">>()
);
Expand Down
Loading