From 20ab08dde9eee2e96cfd5c87b4a2ad71a43f32d6 Mon Sep 17 00:00:00 2001 From: Johan Nyman Date: Tue, 10 Dec 2024 14:10:15 +0100 Subject: [PATCH] chore: minor fixes after code review --- meteor/server/api/deviceTriggers/triggersContext.ts | 3 +++ .../webui/src/client/lib/ReactMeteorData/ReactMeteorData.tsx | 4 ++-- .../components/triggeredActions/TriggeredActionEntry.tsx | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/meteor/server/api/deviceTriggers/triggersContext.ts b/meteor/server/api/deviceTriggers/triggersContext.ts index a68002a9b9..ec563c562b 100644 --- a/meteor/server/api/deviceTriggers/triggersContext.ts +++ b/meteor/server/api/deviceTriggers/triggersContext.ts @@ -50,6 +50,7 @@ class MeteorTriggersCollectionWrapper, options?: FindOptions ): Promise> { + // Note: the _computation is not used, since we are not using Tracker server-side return this.#collection.findFetchAsync(selector, options) } @@ -58,6 +59,7 @@ class MeteorTriggersCollectionWrapper | DBInterface['_id'], options?: FindOneOptions ): Promise { + // Note: the _computation is not used, since we are not using Tracker server-side return this.#collection.findOneAsync(selector, options) } } @@ -97,6 +99,7 @@ export const MeteorTriggersContext: TriggersContext = { }, withComputation: async (_computation, func) => { + // Note: the _computation is not used, since we are not using Tracker server-side return func() }, diff --git a/packages/webui/src/client/lib/ReactMeteorData/ReactMeteorData.tsx b/packages/webui/src/client/lib/ReactMeteorData/ReactMeteorData.tsx index 379908a27c..72a031f2b3 100644 --- a/packages/webui/src/client/lib/ReactMeteorData/ReactMeteorData.tsx +++ b/packages/webui/src/client/lib/ReactMeteorData/ReactMeteorData.tsx @@ -374,12 +374,12 @@ export function useTracker( * This is an alternate implementation which supports promises in the autorun function, and will preserve the previous value until the promise resolves. * * @param {() => Promise} autorun The autorun function to be run. - * @param {React.DependencyList} [deps] A required list of dependenices to limit the tracker re-running. Can be left empty, if tracker + * @param {React.DependencyList} [deps] A required list of dependencies to limit the tracker re-running. Can be left empty, if tracker * has no external dependencies and should only be rerun when it's invalidated. * @param {K} [initial] An optional, initial state of the tracker. If not provided, the tracker may return undefined. * @return {*} {(T | K)} */ -export function useTrackerAsyncTest( +export function useTrackerAsync( autorun: (computation: Tracker.Computation) => Promise, deps: React.DependencyList, initial?: K diff --git a/packages/webui/src/client/ui/Settings/components/triggeredActions/TriggeredActionEntry.tsx b/packages/webui/src/client/ui/Settings/components/triggeredActions/TriggeredActionEntry.tsx index 0eacc998b1..8ecf9d19a3 100644 --- a/packages/webui/src/client/ui/Settings/components/triggeredActions/TriggeredActionEntry.tsx +++ b/packages/webui/src/client/ui/Settings/components/triggeredActions/TriggeredActionEntry.tsx @@ -10,7 +10,7 @@ import { } from '@sofie-automation/blueprints-integration' import classNames from 'classnames' import { DBBlueprintTrigger } from '@sofie-automation/meteor-lib/dist/collections/TriggeredActions' -import { useTracker, useTrackerAsyncTest } from '../../../../lib/ReactMeteorData/ReactMeteorData' +import { useTracker, useTrackerAsync } from '../../../../lib/ReactMeteorData/ReactMeteorData' import { ActionEditor } from './actionEditors/ActionEditor' import { OutputLayers, SourceLayers } from '@sofie-automation/corelib/dist/dataModel/ShowStyleBase' import { flatten, getRandomString } from '../../../../lib/tempLib' @@ -183,7 +183,7 @@ export const TriggeredActionEntry: React.FC = React.memo(function Trigge [triggeredAction?.actionsWithOverrides] ) - const previewItems = useTrackerAsyncTest( + const previewItems = useTrackerAsync( async (computation) => { try { if (!resolvedActions || !selected || !sourceLayers) return []