Skip to content

Commit

Permalink
fix(UI-1262): fix entrypoint deconstruction for manual run (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
RonenMars authored Jan 28, 2025
1 parent a26e788 commit 053f108
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/store/useManualRunStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const store: StateCreator<ManualRunStore> = (set, get) => ({
projectId,
{ activeDeployment, entrypointFunction, filePath, files, isJson, isManualRunEnabled, params }
) => {
const { entrypointFunction: currentEntrypoint, filePath: currentFile } = get().projectManualRun[projectId];
const previousProjectManualRunState = get().projectManualRun[projectId];
set((state) => {
const projectData = {
...defaultManualRunState,
Expand All @@ -82,7 +82,12 @@ const store: StateCreator<ManualRunStore> = (set, get) => ({
projectData.files = files;
projectData.fileOptions = fileOptions;

if (!files[currentFile?.value]?.includes(currentEntrypoint?.value)) {
const { filePath: prevFilePath, entrypointFunction: prevEntrypointFunction } =
previousProjectManualRunState || {};
const fileExists = prevFilePath?.value && files?.[prevFilePath.value];
const entrypointExists = fileExists?.includes(prevEntrypointFunction?.value);

if (!entrypointExists) {
Object.assign(projectData, { filePath: fileOptions[0], entrypointFunction: emptySelectItem });
}
}
Expand Down

0 comments on commit 053f108

Please sign in to comment.