fix: apply delay (#494)

* fix: bug with applying delays

* fix: show delay data only in production screens

* chore: cover delay with feature test

* refactor: simplify type assertion
This commit is contained in:
Carlos Valente
2023-08-23 22:31:15 +02:00
committed by GitHub
parent 657cc22b44
commit e5fdf27f6c
16 changed files with 517 additions and 431 deletions
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'react';
import { OntimeEvent, SupportedEvent } from 'ontime-types';
import { isOntimeEvent, OntimeEvent } from 'ontime-types';
import CopyTag from '../../common/components/copy-tag/CopyTag';
import { useEventAction } from '../../common/hooks/useEventAction';
@@ -29,8 +29,8 @@ export default function EventEditor() {
}
const event = data.find((event) => event.id === openId);
if (event && event.type === SupportedEvent.Event) {
setEvent(event as OntimeEvent);
if (event && isOntimeEvent(event)) {
setEvent(event);
}
}, [data, openId]);