Skip to content

Commit

Permalink
Merge pull request #134 from os2display/feature/2484-touch-regions
Browse files Browse the repository at this point in the history
Fixed remote component loading issue for touch regions
  • Loading branch information
tuj authored Sep 23, 2024
2 parents d460091 + e15b3e0 commit 09eb894
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions src/components/touch-region.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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]}
/>
Expand Down

0 comments on commit 09eb894

Please sign in to comment.