mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
refactor: simplify element lookup
This commit is contained in:
committed by
Carlos Valente
parent
8daf3313f2
commit
ef3d541eb3
@@ -81,11 +81,6 @@ export function usePartialRundown(cb: (event: ExtendedEntry<OntimeEntry>) => boo
|
|||||||
export function useEntry(entryId: EntryId | null): OntimeEntry | null {
|
export function useEntry(entryId: EntryId | null): OntimeEntry | null {
|
||||||
const { data: rundown } = useRundown();
|
const { data: rundown } = useRundown();
|
||||||
|
|
||||||
// track the specific entry we care about
|
if (entryId === null) return null;
|
||||||
const entry = useMemo(() => {
|
return rundown.entries[entryId] ?? null;
|
||||||
if (entryId === null) return null;
|
|
||||||
return rundown.entries[entryId] ?? null;
|
|
||||||
}, [entryId, rundown.entries]);
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user