diff --git a/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.js b/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.js index 01ea712306f..997591fa335 100644 --- a/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.js +++ b/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.js @@ -11,21 +11,21 @@ ProgressBar.template = 'web_editor.ProgressBar'; export class UploadProgressToast extends Component { setup() { - this.state = useState({ hide: false }); + this.state = useState({ + isVisible: false, + numberOfFiles: 0, + }); useEffect((numberOfFiles) => { - if (numberOfFiles) { - this.state.hide = false; + if (numberOfFiles === 0) { + this.state.isVisible = false; } + if (numberOfFiles > this.state.numberOfFiles) { + this.state.isVisible = true; + } + this.state.numberOfFiles = numberOfFiles; }, () => [Object.keys(this.props.files).length]); } - - get show() { - if (!this.props.files || !Object.keys(this.props.files).length) { - return false; - } - return !this.state.hide; - } } UploadProgressToast.defaultProps = { files: {}, diff --git a/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.xml b/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.xml index ac8a864d0cd..c31620f3b39 100644 --- a/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.xml +++ b/addons/web_editor/static/src/components/upload_progress_toast/upload_progress_toast.xml @@ -18,10 +18,8 @@
-