Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
name: "Share File or Folder",
description:
"Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
version: "0.1.9",
version: "0.2.0",
type: "action",
props: {
googleDrive,
Expand All @@ -31,6 +31,16 @@ export default {
],
optional: true,
},
useFileOrFolder: {
type: "string",
label: "Use File or Folder",
description: "Whether to use a file or a folder for this action",
reloadProps: true,
options: [
"File",
"Folder",
],
},
fileId: {
propDefinition: [
googleDrive,
Expand All @@ -39,7 +49,7 @@ export default {
drive: c.drive,
}),
],
optional: true,
hidden: true,
description: "The file to share. You must specify either a file or a folder.",
},
folderId: {
Expand All @@ -50,7 +60,7 @@ export default {
drive: c.drive,
}),
],
optional: true,
hidden: true,
description: "The folder to share. You must specify either a file or a folder.",
},
type: {
Expand All @@ -61,11 +71,20 @@ export default {
reloadProps: true,
},
},
async additionalProps() {
const obj = {};
async additionalProps(previousProps) {
const {
fileId, folderId, type,
fileId, folderId, type, useFileOrFolder,
} = this;

if (useFileOrFolder === "File") {
previousProps.fileId.hidden = false;
previousProps.folderId.hidden = true;
} else if (useFileOrFolder === "Folder") {
previousProps.fileId.hidden = true;
previousProps.folderId.hidden = false;
}

const obj = {};
if (!(fileId || folderId) || !type) return obj;
Comment on lines +74 to 88
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the early return condition to prevent UI issues.

The early return condition if (!(fileId || folderId) || !type) checks for fileId/folderId before they're visible, which could prevent the UI from showing the input fields. This should only check for the type property.

     if (useFileOrFolder === "File") {
       previousProps.fileId.hidden = false;
       previousProps.folderId.hidden = true;
     } else if (useFileOrFolder === "Folder") {
       previousProps.fileId.hidden = true;
       previousProps.folderId.hidden = false;
     }

     const obj = {};
-    if (!(fileId || folderId) || !type) return obj;
+    if (!type) return obj;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async additionalProps(previousProps) {
const {
fileId, folderId, type,
fileId, folderId, type, useFileOrFolder,
} = this;
if (useFileOrFolder === "File") {
previousProps.fileId.hidden = false;
previousProps.folderId.hidden = true;
} else if (useFileOrFolder === "Folder") {
previousProps.fileId.hidden = true;
previousProps.folderId.hidden = false;
}
const obj = {};
if (!(fileId || folderId) || !type) return obj;
async additionalProps(previousProps) {
const {
fileId, folderId, type, useFileOrFolder,
} = this;
if (useFileOrFolder === "File") {
previousProps.fileId.hidden = false;
previousProps.folderId.hidden = true;
} else if (useFileOrFolder === "Folder") {
previousProps.fileId.hidden = true;
previousProps.folderId.hidden = false;
}
const obj = {};
if (!type) return obj;


const emailAddress = {
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_drive",
"version": "0.8.8",
"version": "0.8.9",
"description": "Pipedream Google_drive Components",
"main": "google_drive.app.mjs",
"keywords": [
Expand Down
Loading