Skip to content

Commit

Permalink
chore: minor fixes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Dec 10, 2024
1 parent c2a6522 commit 20ab08d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions meteor/server/api/deviceTriggers/triggersContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MeteorTriggersCollectionWrapper<DBInterface extends { _id: ProtectedString
selector: MongoQuery<DBInterface>,
options?: FindOptions<DBInterface>
): Promise<Array<DBInterface>> {
// Note: the _computation is not used, since we are not using Tracker server-side
return this.#collection.findFetchAsync(selector, options)
}

Expand All @@ -58,6 +59,7 @@ class MeteorTriggersCollectionWrapper<DBInterface extends { _id: ProtectedString
selector: MongoQuery<DBInterface> | DBInterface['_id'],
options?: FindOneOptions<DBInterface>
): Promise<DBInterface | undefined> {
// Note: the _computation is not used, since we are not using Tracker server-side
return this.#collection.findOneAsync(selector, options)
}
}
Expand Down Expand Up @@ -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()
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ export function useTracker<T, K extends undefined | T = undefined>(
* This is an alternate implementation which supports promises in the autorun function, and will preserve the previous value until the promise resolves.
*
* @param {() => Promise<T>} 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<T, K extends undefined | T = undefined>(
export function useTrackerAsync<T, K extends undefined | T = undefined>(
autorun: (computation: Tracker.Computation) => Promise<T>,
deps: React.DependencyList,
initial?: K
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -183,7 +183,7 @@ export const TriggeredActionEntry: React.FC<IProps> = React.memo(function Trigge
[triggeredAction?.actionsWithOverrides]
)

const previewItems = useTrackerAsyncTest<IWrappedAdLib[], IWrappedAdLib[]>(
const previewItems = useTrackerAsync<IWrappedAdLib[], IWrappedAdLib[]>(
async (computation) => {
try {
if (!resolvedActions || !selected || !sourceLayers) return []
Expand Down

0 comments on commit 20ab08d

Please sign in to comment.