feat(frontend): add a refresh component control to the DB Studio (#3490)

* feat(frontend): add a refresh component control to the DB Studio

* feat(frontend): add a refresh component control to the DB Studio

* feat(frontend): clean up

* feat(frontend): improve recompute to handle sub runnable

* feat(frontend): clean up
This commit is contained in:
Faton Ramadani
2024-03-29 12:40:58 +01:00
committed by GitHub
parent e0b34edcc8
commit e3512b3eac
3 changed files with 11 additions and 0 deletions
@@ -140,6 +140,7 @@ export async function eval_like(
invalidate?: (key: string, error: string) => void
validateAll?: () => void
clearFiles?: () => void
showToast?: (message: string, error?: boolean) => void
}
>,
worldStore: World | undefined,
@@ -183,6 +184,13 @@ export async function eval_like(
controlComponents[id]?.setTab?.(index)
},
(id) => {
// Check for the existence of sub-runnables:
// For example a_count for Database Studio
if (runnableComponents[`${id}_count`]?.cb) {
runnableComponents[`${id}_count`]?.cb?.forEach((f) => f())
}
runnableComponents[id]?.cb?.forEach((f) => f())
},
(id) => {
@@ -126,6 +126,8 @@ export function getComponentControl(type: keyof typeof components): Array<Compon
return [setValue, validate, validateAll, invalidate]
case 'tablecomponent':
return [setSelectedIndex]
case 'dbexplorercomponent':
return [recompute]
default:
if (components[type].initialData['componentInput']) {
return [recompute]
@@ -258,6 +258,7 @@ export type AppViewerContext = {
invalidate?: (key: string, error: string) => void
validateAll?: () => void
clearFiles?: () => void
showToast?: (message: string, error?: boolean) => void
}
>
>