Skip to content

Commit

Permalink
fix: UIBlueprintUpgradeStatuses crashing if no playlists in the system
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Nov 15, 2023
1 parent 54d6719 commit 3491ec5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
8 changes: 5 additions & 3 deletions meteor/client/ui/Settings/Upgrades/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export function UpgradesView(): JSX.Element {

<table className="table">
<thead>
<th>Name</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<tr>
<th>Name</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{isReady && statuses && statuses.length === 0 && (
Expand Down
20 changes: 2 additions & 18 deletions meteor/server/publications/blueprintUpgradeStatus/publication.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { BlueprintId, ShowStyleBaseId, StudioId } from '@sofie-automation/corelib/dist/dataModel/Ids'
import { MongoFieldSpecifierOnesStrict } from '@sofie-automation/corelib/dist/mongo'
import { ReadonlyDeep } from 'type-fest'
import { CustomCollectionName, MeteorPubSub } from '../../../lib/api/pubsub'
import { literal, ProtectedString, protectString } from '../../../lib/lib'
import { ProtectedString, protectString } from '../../../lib/lib'
import {
CustomPublish,
CustomPublishCollection,
Expand All @@ -16,8 +15,6 @@ import { NoSecurityReadAccess } from '../../security/noSecurity'
import { LiveQueryHandle } from '../../lib/lib'
import { ContentCache, createReactiveContentCache, ShowStyleBaseFields, StudioFields } from './reactiveContentCache'
import { UpgradesContentObserver } from './upgradesContentObserver'
import { DBRundownPlaylist } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
import { RundownPlaylists } from '../../collections'
import { BlueprintMapEntry, checkDocUpgradeStatus } from './checkStatus'
import { BlueprintManifestType } from '@sofie-automation/blueprints-integration'
import { DBShowStyleBase } from '@sofie-automation/corelib/dist/dataModel/ShowStyleBase'
Expand All @@ -38,23 +35,10 @@ interface BlueprintUpgradeStatusUpdateProps {
invalidateBlueprintIds: BlueprintId[]
}

type RundownPlaylistFields = '_id' | 'studioId'
const rundownPlaylistFieldSpecifier = literal<
MongoFieldSpecifierOnesStrict<Pick<DBRundownPlaylist, RundownPlaylistFields>>
>({
_id: 1,
studioId: 1,
})

async function setupBlueprintUpgradeStatusPublicationObservers(
args: ReadonlyDeep<BlueprintUpgradeStatusArgs>,
_args: ReadonlyDeep<BlueprintUpgradeStatusArgs>,
triggerUpdate: TriggerUpdate<BlueprintUpgradeStatusUpdateProps>
): Promise<LiveQueryHandle[]> {
const playlist = (await RundownPlaylists.findOneAsync(args.playlistId, {
projection: rundownPlaylistFieldSpecifier,
})) as Pick<DBRundownPlaylist, RundownPlaylistFields> | undefined
if (!playlist) throw new Error(`RundownPlaylist "${args.playlistId}" not found!`)

// TODO - can this be done cheaper?
const cache = createReactiveContentCache()

Expand Down

0 comments on commit 3491ec5

Please sign in to comment.