Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ad92c12
fix: workflow page limit in serializer
athul-rs Aug 11, 2025
f70d076
UN-1720 [FIX] Improve workflow_id validation error message in Execute…
athul-rs Aug 11, 2025
9ed00a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 11, 2025
c8e97f5
UN-1720 [FIX] Improve ExecuteWorkflowSerializer validations based on …
athul-rs Aug 11, 2025
249fa00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 11, 2025
627ab60
UN-1720 [FIX] Address code review feedback for ExecuteWorkflowSerializer
athul-rs Aug 13, 2025
ca6d4d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 13, 2025
17dc78f
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
athul-rs Aug 13, 2025
0733d01
UN-1720 [FEAT] Add frontend validation for workflow file upload limits
athul-rs Aug 13, 2025
1455465
UN-1720 [FIX] Add error code to file validation for better error hand…
athul-rs Aug 13, 2025
18edaa5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 13, 2025
e2b38fe
Builder error: prettier fix
athul-rs Aug 13, 2025
b019bda
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
athul-rs Aug 19, 2025
b611dd6
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
gaya3-zipstack Aug 22, 2025
fc18b30
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
gaya3-zipstack Aug 22, 2025
eac64fb
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
gaya3-zipstack Aug 22, 2025
372e1d6
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
athul-rs Aug 22, 2025
323faaf
refactor: Rename MAX_WORKFLOW_EXECUTION_FILES to WORKFLOW_PAGE_MAX_FILES
athul-rs Aug 22, 2025
ff1d202
fix: Refactor beforeUpload to avoid multiple identical returns
athul-rs Aug 22, 2025
a471cf9
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
athul-rs Aug 22, 2025
7f9943f
Merge branch 'main' into UN-1720-Introducing-workflow-page-limit
athul-rs Aug 22, 2025
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
6 changes: 3 additions & 3 deletions frontend/src/components/agency/file-upload/FileUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const FileUpload = ({
const beforeUpload = (file) => {
if (fileList.length >= WORKFLOW_PAGE_MAX_FILES) {
message.error(WORKFLOW_VALIDATION_MESSAGES.MAX_FILES_EXCEEDED);
return false;
} else {
setFileList([...fileList, file]);
}
setFileList([...fileList, file]);
return false;
return false; // Always prevent automatic upload (manual upload on submit)
};
Comment on lines 21 to 28
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 22, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix multi-select race: use functional updates inside beforeUpload.

When selecting multiple files at once (multiple={true}), React may batch setState calls and each beforeUpload invocation reads the same captured fileList. This can drop files or exceed limits. Use a functional updater and decide based on prev length. Also de-duplicate the error message with a stable key.

Apply this diff:

-  const beforeUpload = (file) => {
-    if (fileList.length >= WORKFLOW_PAGE_MAX_FILES) {
-      message.error(WORKFLOW_VALIDATION_MESSAGES.MAX_FILES_EXCEEDED);
-    } else {
-      setFileList([...fileList, file]);
-    }
-    return false; // Always prevent automatic upload (manual upload on submit)
-  };
+  const beforeUpload = (file) => {
+    let rejected = false;
+    setFileList((prev) => {
+      if (prev.length >= WORKFLOW_PAGE_MAX_FILES) {
+        rejected = true;
+        return prev;
+      }
+      return [...prev, file];
+    });
+    if (rejected) {
+      message.error({
+        key: "max-files",
+        content: WORKFLOW_VALIDATION_MESSAGES.MAX_FILES_EXCEEDED,
+      });
+    }
+    return false; // Always prevent automatic upload (manual upload on submit)
+  };
📝 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
const beforeUpload = (file) => {
if (fileList.length >= WORKFLOW_PAGE_MAX_FILES) {
message.error(WORKFLOW_VALIDATION_MESSAGES.MAX_FILES_EXCEEDED);
return false;
} else {
setFileList([...fileList, file]);
}
setFileList([...fileList, file]);
return false;
return false; // Always prevent automatic upload (manual upload on submit)
};
const beforeUpload = (file) => {
let rejected = false;
setFileList((prev) => {
if (prev.length >= WORKFLOW_PAGE_MAX_FILES) {
rejected = true;
return prev;
}
return [...prev, file];
});
if (rejected) {
message.error({
key: "max-files",
content: WORKFLOW_VALIDATION_MESSAGES.MAX_FILES_EXCEEDED,
});
}
return false; // Always prevent automatic upload (manual upload on submit)
};
🤖 Prompt for AI Agents
In frontend/src/components/agency/file-upload/FileUpload.jsx around lines 21 to
28, the beforeUpload handler reads a stale fileList when multiple files are
selected causing lost files and duplicated messages; change setFileList to use
the functional updater (setFileList(prev => { compute newList based on prev,
enforce WORKFLOW_PAGE_MAX_FILES limit, and return the new array })) and base the
limit check on prev.length so each call is consistent; also dedupe the error
notification by passing a stable key to message.error (e.g.
'max-files-exceeded') so the error is shown only once per selection; keep
returning false to prevent automatic upload.

Copy link
Contributor

Choose a reason for hiding this comment

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

@athul-rs check if this is valid

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @CodeRabbit in a new comment, and I'll come hopping out!


const submitFile = () => {
Expand Down