Skip to content

Commit

Permalink
fix(types): fixing the preview types for caching
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Feb 1, 2025
1 parent cdfee41 commit 3509bce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
24 changes: 8 additions & 16 deletions src/setup/cache-grouped-scripts.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
// Description: Clear Timestamps

import type { Script } from "../types/core"
import {
getGroupedScripts,
processScriptPreview,
scriptFlags,
} from "../api/kit.js"
import { Channel } from "../core/enum.js"
import { formatChoices } from "../core/utils.js"
import type { Script } from '../types/core'
import { getGroupedScripts, processScriptPreview, scriptFlags } from '../api/kit.js'
import { Channel } from '../core/enum.js'
import { formatChoices } from '../core/utils.js'

let groupedScripts = await getGroupedScripts()
let scripts = formatChoices(groupedScripts)
let firstScript = scripts.find(script => !script.skip)
let preview = ``
let firstScript = scripts.find((script) => !script.skip)
let preview = ''
try {
preview = await processScriptPreview(
firstScript as unknown as Script
)()
preview = (await processScriptPreview(firstScript as unknown as Script)()) as string
} catch {}

process.send({
channel: Channel.CACHE_SCRIPTS,
scripts,
preview,
scriptFlags,
scriptFlags
})

export {}
2 changes: 1 addition & 1 deletion src/workers/cache-grouped-scripts-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const parseMainMenu = async (stamp: Stamp | null) => {
let preview = ''
if (firstScript) {
try {
preview = await processScriptPreview(firstScript)()
preview = (await processScriptPreview(firstScript)()) as string
} catch (error) {
logToParent(`Error processing script preview: ${error}`)
}
Expand Down

0 comments on commit 3509bce

Please sign in to comment.