From cd94f72faaeb089353e3fb7b4de2cd10a348ad16 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 12 Nov 2021 15:28:08 +0000 Subject: [PATCH] Replace manual usage of square brackets with string-templates makePropSafe util --- packages/client/src/components/app/blocks/CardsBlock.svelte | 5 +++-- packages/client/src/components/app/blocks/DataBlock.svelte | 3 ++- packages/client/src/components/app/blocks/TableBlock.svelte | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/app/blocks/CardsBlock.svelte b/packages/client/src/components/app/blocks/CardsBlock.svelte index 9eccb2b2d1..1a8df189af 100644 --- a/packages/client/src/components/app/blocks/CardsBlock.svelte +++ b/packages/client/src/components/app/blocks/CardsBlock.svelte @@ -3,6 +3,7 @@ import Block from "components/Block.svelte" import BlockComponent from "components/BlockComponent.svelte" import { Heading } from "@budibase/bbui" + import { makePropSafe as safe } from "@budibase/string-templates" export let title export let dataSource @@ -103,7 +104,7 @@ } const col = linkColumn || "_id" const split = url.split("/:") - return `${split[0]}/{{ [${repeaterId}].[${col}] }}` + return `${split[0]}/{{ ${safe(repeaterId)}.${safe(col)} }}` } // Load the datasource schema on mount so we can determine column types @@ -171,7 +172,7 @@ bind:id={repeaterId} context="repeater" props={{ - dataProvider: `{{ literal [${dataProviderId}] }}`, + dataProvider: `{{ literal ${safe(dataProviderId)} }}`, direction: "row", hAlign: "stretch", vAlign: "top", diff --git a/packages/client/src/components/app/blocks/DataBlock.svelte b/packages/client/src/components/app/blocks/DataBlock.svelte index 935de48cbc..413d1df65e 100644 --- a/packages/client/src/components/app/blocks/DataBlock.svelte +++ b/packages/client/src/components/app/blocks/DataBlock.svelte @@ -3,6 +3,7 @@ import Block from "components/Block.svelte" import Placeholder from "components/app/Placeholder.svelte" import { getContext } from "svelte" + import { makePropSafe as safe } from "@budibase/string-templates" export let dataSource export let filter @@ -44,7 +45,7 @@ type="repeater" context="repeater" props={{ - dataProvider: `{{ literal [${providerId}] }}`, + dataProvider: `{{ literal ${safe(providerId)} }}`, noRowsMessage, direction, hAlign, diff --git a/packages/client/src/components/app/blocks/TableBlock.svelte b/packages/client/src/components/app/blocks/TableBlock.svelte index ac2a36adc7..255cbf44cf 100644 --- a/packages/client/src/components/app/blocks/TableBlock.svelte +++ b/packages/client/src/components/app/blocks/TableBlock.svelte @@ -3,6 +3,7 @@ import Block from "components/Block.svelte" import BlockComponent from "components/BlockComponent.svelte" import { Heading } from "@budibase/bbui" + import { makePropSafe as safe } from "@budibase/string-templates" export let title export let dataSource @@ -61,7 +62,7 @@ operator: column.type === "string" ? "string" : "equal", type: "string", valueType: "Binding", - value: `{{ [${formId}].[${column.name}] }}`, + value: `{{ ${safe(formId)}.${safe(column.name)} }}`, }) }) return enrichedFilter @@ -147,7 +148,7 @@