From e15b3e0f07be9e8a8a4ab5010fc92bfd9f444fa8 Mon Sep 17 00:00:00 2001 From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:46:09 +0200 Subject: [PATCH] 2484: Fixed remote component loading issue for touch regions --- CHANGELOG.md | 2 ++ src/components/touch-region.jsx | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bd53c3..ef40f5c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## Unreleased +- [#134](https://github.com/os2display/display-client/pull/134) + - Fixed remote loader for touch regions. - [#133](https://github.com/os2display/display-client/pull/133) - Added error message ER201 on screen when remote component could not load. - Added error timestamp to remote component loader, to force reload on error. diff --git a/src/components/touch-region.jsx b/src/components/touch-region.jsx index 224f37ab..d7543fb0 100644 --- a/src/components/touch-region.jsx +++ b/src/components/touch-region.jsx @@ -49,6 +49,20 @@ function TouchRegion({ region }) { document.dispatchEvent(slideDoneEvent); }; + /** + * The slide has encountered an error. + * + * @param {object} slideWithError - The slide + */ + const slideError = (slideWithError) => { + // Set error timestamp to force reload. + const slide = slides.find( + (slideElement) => slideElement.executionId === slideWithError.executionId + ); + slide.errorTimestamp = new Date().getTime(); + slideDone(slideWithError); + }; + /** * Handle region content event. * @@ -125,6 +139,8 @@ function TouchRegion({ region }) { id={currentSlide.executionId} run={runId} slideDone={slideDone} + slideError={slideError} + errorTimestamp={currentSlide.errorTimestamp} key={currentSlide.executionId} forwardRef={nodeRefs[currentSlide.executionId]} />