diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e229a6a618..304c9cfad863 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ component.][11452] - [New documentation editor provides improved Markdown editing experience, and paves the way for new documentation features.][11469] +- ["Write" button in component menu allows to evaluate it separately from the + rest of the workflow][11523]. [11151]: https://github.com/enso-org/enso/pull/11151 [11271]: https://github.com/enso-org/enso/pull/11271 @@ -40,6 +42,7 @@ [11448]: https://github.com/enso-org/enso/pull/11448 [11452]: https://github.com/enso-org/enso/pull/11452 [11469]: https://github.com/enso-org/enso/pull/11469 +[11523]: https://github.com/enso-org/enso/pull/11523 #### Enso Standard Library diff --git a/app/gui/src/project-view/components/CircularMenu.vue b/app/gui/src/project-view/components/CircularMenu.vue index 79b3edfcb635..c172426ed13f 100644 --- a/app/gui/src/project-view/components/CircularMenu.vue +++ b/app/gui/src/project-view/components/CircularMenu.vue @@ -15,6 +15,7 @@ const props = defineProps<{ isEnterable: boolean matchableNodeColors: Set documentationUrl: string | undefined + isBeingRecomputed: boolean }>() const emit = defineEmits<{ 'update:isVisualizationEnabled': [isVisualizationEnabled: boolean] @@ -25,6 +26,7 @@ const emit = defineEmits<{ delete: [] createNewNode: [] toggleDocPanel: [] + recompute: [] }>() const isDropdownOpened = ref(false) @@ -92,6 +94,14 @@ function readableBinding(binding: keyof (typeof graphBindings)['bindings']) { Add Comment + + + Write + Color Component diff --git a/app/gui/src/project-view/components/GraphEditor.vue b/app/gui/src/project-view/components/GraphEditor.vue index 9e76ecec4b20..c340812f48ca 100644 --- a/app/gui/src/project-view/components/GraphEditor.vue +++ b/app/gui/src/project-view/components/GraphEditor.vue @@ -47,6 +47,7 @@ import type { NodeId } from '@/stores/graph' import { provideGraphStore } from '@/stores/graph' import type { RequiredImport } from '@/stores/graph/imports' import { useProjectStore } from '@/stores/project' +import { provideNodeExecution } from '@/stores/project/nodeExecution' import { useSettings } from '@/stores/settings' import { provideSuggestionDbStore } from '@/stores/suggestionDatabase' import type { SuggestionId, Typename } from '@/stores/suggestionDatabase/entry' @@ -87,6 +88,7 @@ const widgetRegistry = provideWidgetRegistry(graphStore.db) const _visualizationStore = provideVisualizationStore(projectStore) const visible = injectVisibility() provideFullscreenContext(rootNode) +provideNodeExecution(projectStore) ;(window as any)._mockSuggestion = suggestionDb.mockSuggestion onMounted(() => { diff --git a/app/gui/src/project-view/components/GraphEditor/GraphNode.vue b/app/gui/src/project-view/components/GraphEditor/GraphNode.vue index 006f4538b21d..8ba589aad4c2 100644 --- a/app/gui/src/project-view/components/GraphEditor/GraphNode.vue +++ b/app/gui/src/project-view/components/GraphEditor/GraphNode.vue @@ -27,6 +27,7 @@ import { injectKeyboard } from '@/providers/keyboard' import { useGraphStore, type Node } from '@/stores/graph' import { asNodeId } from '@/stores/graph/graphDatabase' import { useProjectStore } from '@/stores/project' +import { useNodeExecution } from '@/stores/project/nodeExecution' import { suggestionDocumentationUrl } from '@/stores/suggestionDatabase/entry' import { Ast } from '@/util/ast' import type { AstId } from '@/util/ast/abstract' @@ -79,6 +80,7 @@ const nodeSelection = injectGraphSelection(true) const projectStore = useProjectStore() const graph = useGraphStore() const navigator = injectGraphNavigator(true) +const nodeExecution = useNodeExecution() const nodeId = computed(() => asNodeId(props.node.rootExpr.externalId)) const potentialSelfArgumentId = computed(() => props.node.primarySubject) @@ -409,6 +411,21 @@ watchEffect(() => { const dataSource = computed( () => ({ type: 'node', nodeId: props.node.rootExpr.externalId }) as const, ) + +// === Recompute node expression === + +// The node is considered to be recomputing for at least this time. +const MINIMAL_EXECUTION_TIMEOUT_MS = 500 +const recomputationTimeout = ref(false) +const actualRecomputationStatus = nodeExecution.isBeingRecomputed(nodeId.value) +const isBeingRecomputed = computed( + () => recomputationTimeout.value || actualRecomputationStatus.value, +) +function recomputeOnce() { + nodeExecution.recomputeOnce(nodeId.value, 'Live') + recomputationTimeout.value = true + setTimeout(() => (recomputationTimeout.value = false), MINIMAL_EXECUTION_TIMEOUT_MS) +}