From 5f7cfb5731b094381a5b1ccfc97732392b14d3af Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 20 Sep 2022 11:09:58 +0100 Subject: [PATCH] Filter 'link' fields from the Current User bindings --- .../builder/src/builderStore/dataBinding.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index bf589ad4a9..ca36380077 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -393,20 +393,25 @@ export const getUserBindings = () => { const { schema } = getSchemaForTable(TableNames.USERS) const keys = Object.keys(schema).sort() const safeUser = makePropSafe("user") - keys.forEach(key => { + + bindings = keys.reduce((acc, key) => { const fieldSchema = schema[key] - bindings.push({ - type: "context", - runtimeBinding: `${safeUser}.${makePropSafe(key)}`, - readableBinding: `Current User.${key}`, - // Field schema and provider are required to construct relationship - // datasource options, based on bindable properties - fieldSchema, - providerId: "user", - category: "Current User", - icon: "User", - }) - }) + if (fieldSchema.type !== "link") { + acc.push({ + type: "context", + runtimeBinding: `${safeUser}.${makePropSafe(key)}`, + readableBinding: `Current User.${key}`, + // Field schema and provider are required to construct relationship + // datasource options, based on bindable properties + fieldSchema, + providerId: "user", + category: "Current User", + icon: "User", + }) + } + return acc + }, []) + return bindings }