Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 197efa8

Browse files
committed
fix(packages/core): mmr/show has leftover debug output
also removes any explicit `any` from bottom-stripe.ts Fixes #3112
1 parent 8ca0acd commit 197efa8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/core/src/models/mmr/content-types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export function isStringWithContentType(entity: Entity): entity is StringContent
5050
* contentType } wrapper.
5151
*
5252
*/
53-
type FunctionThatProducesContent<T extends MetadataBearing> = (tab: Tab, entity: T) => ScalarResource | ScalarContent
53+
type FunctionThatProducesContent<T extends MetadataBearing> = (
54+
tab: Tab,
55+
entity: T
56+
) => ScalarResource | ScalarContent | Promise<ScalarResource> | Promise<ScalarContent>
5457
interface FunctionContent<T extends MetadataBearing> {
5558
content: FunctionThatProducesContent<T>
5659
}

packages/core/src/models/mmr/show.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function format<T extends MetadataBearing>(
4949
return format(tab, mmr, { content: resource })
5050
} else if (isFunctionContent(resource)) {
5151
// then resource.content is a funciton that will provide the information
52-
return format(tab, mmr, resource.content(tab, mmr))
52+
return format(tab, mmr, await resource.content(tab, mmr))
5353
} else if (isCommandStringContent(resource)) {
5454
const content = await tab.REPL.qexec<ScalarResource | ScalarContent>(resource.content)
5555
return format(tab, mmr, content)
@@ -123,11 +123,10 @@ export async function show(tab: Tab, mmr: MultiModalResponse) {
123123

124124
const modesWithButtons = mmr.buttons ? modes.concat(formatButtons(mmr.buttons)) : modes
125125

126-
addModeButtons(tab, modesWithButtons, mmr)
126+
addModeButtons(tab, modesWithButtons, mmr, { preserveBackButton: true })
127127

128128
const defaultMode = modes.find(_ => _.defaultMode) || modes[0]
129129

130-
console.error('!!!!!', modesWithButtons)
131130
const content = typeof defaultMode.direct === 'function' ? await defaultMode.direct(tab, mmr) : defaultMode.direct
132131

133132
if (content) {

packages/core/src/webapp/bottom-stripe.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ const callDirect = async (
9696
}
9797
} else if (typeof makeView === 'function') {
9898
debug('makeView as function')
99-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
100-
return Promise.resolve(makeView(tab, entity) as any)
99+
return Promise.resolve(makeView(tab, entity) as DirectResult)
101100
} else if (isDirectViewEntity(makeView)) {
102101
const combined = Object.assign({}, entity, makeView)
103102
return combined

0 commit comments

Comments
 (0)