Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/file-uploader-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We fixed an issue where the "Invalid file format" validation error could not be dismissed and persisted after uploading a valid file.

## [2.4.2] - 2026-04-23

### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement, useCallback } from "react";
import { FileUploaderContainerProps } from "../../typings/FileUploaderProps";
import { ActionButton, FileActionButton } from "./ActionButton";

Check warning on line 3 in packages/pluggableWidgets/file-uploader-web/src/components/ActionsBar.tsx

View workflow job for this annotation

GitHub Actions / Run code quality check

`./ActionButton` import should occur before import of `../../typings/FileUploaderProps`
import { IconInternal } from "@mendix/widget-plugin-component-kit/IconInternal";

Check warning on line 4 in packages/pluggableWidgets/file-uploader-web/src/components/ActionsBar.tsx

View workflow job for this annotation

GitHub Actions / Run code quality check

`@mendix/widget-plugin-component-kit/IconInternal` import should occur before import of `../../typings/FileUploaderProps`
import { FileStore } from "../stores/FileStore";
import { useTranslationsStore } from "../utils/useTranslationsStore";
Expand All @@ -11,6 +11,10 @@
}

export const ActionsBar = ({ actions, store }: ButtonsBarProps): ReactElement | null => {
if (store.fileStatus === "validationError") {
return <DismissActionsBar store={store} />;
}

if (!actions) {
return <DefaultActionsBar store={store} />;
}
Expand Down Expand Up @@ -70,6 +74,25 @@
);
}

function DismissActionsBar({ store }: ButtonsBarProps): ReactElement {
const translations = useTranslationsStore();

const onDismiss = useCallback(() => {
store.dismiss();
}, [store]);

return (
<div className={"entry-details-actions"}>
<ActionButton
icon={<span className={"remove-icon"} aria-hidden />}
title={translations.get("removeButtonTextMessage")}
action={onDismiss}
isDisabled={false}
/>
</div>
);
}

function onDownloadClick(fileUrl: string | undefined): void {
if (!fileUrl) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class FileStore {
imagePreviewUrl: computed,
upload: action,
fetchMxObject: action,
markMissing: action
markMissing: action,
dismiss: action
});
}

Expand All @@ -76,6 +77,10 @@ export class FileStore {
this.errorDescription = errorMessage;
}

dismiss(): void {
this._rootStore.files = this._rootStore.files.filter(f => f !== this);
}

canExecute(listAction: ListActionValue): boolean {
if (!this._objectItem) {
return false;
Expand Down Expand Up @@ -123,6 +128,7 @@ export class FileStore {
runInAction(() => {
this.fileStatus = "done";
this._rootStore.objectCreationHelper.reportUploadSuccess(this._objectItem!);
this._rootStore.dismissValidationErrors();
});
} catch (_e: unknown) {
runInAction(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class FileUploaderStore {
makeObservable(this, {
updateProps: action,
processDrop: action,
dismissValidationErrors: action,
setMessage: action,
processExistingFileItem: action,
files: observable,
Expand Down Expand Up @@ -142,6 +143,10 @@ export class FileUploaderStore {
this.errorMessage = msg;
}

dismissValidationErrors(): void {
this.files = this.files.filter(file => file.fileStatus !== "validationError");
}

processDrop(acceptedFiles: File[], fileRejections: FileRejection[]): void {
if (!this.objectCreationHelper.canCreateFiles) {
console.error(
Expand All @@ -158,6 +163,7 @@ export class FileUploaderStore {
return;
}

this.dismissValidationErrors();
this.setMessage();

for (const file of fileRejections) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ Place your custom CSS here
}

&.invalid {
opacity: 0.7;
.entry-details-preview,
.entry-details-main {
opacity: 0.5;
}
.download-icon {
visibility: hidden;
}
.entry-details-actions {
display: none;
}
}
}
}
Expand Down
Loading