Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): do not load graph if never displayed (fix #1602) #1719

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/ui/client/components/FileDetails.vue
Expand Up @@ -9,6 +9,7 @@ import type { ModuleGraphData } from '#types'
const data = ref<ModuleGraphData>({ externalized: [], graph: {}, inlined: [] })
const graph = ref<ModuleGraph>({ nodes: [], links: [] })
const draft = ref(false)
const hasGraphBeenDisplayed = ref(false)

debouncedWatch(
current,
Expand All @@ -28,6 +29,9 @@ const open = () => {
}

const changeViewMode = (view: Params['view']) => {
if (view === 'graph')
hasGraphBeenDisplayed.value = true

viewMode.value = view
}
const consoleCount = computed(() => {
Expand Down Expand Up @@ -89,7 +93,9 @@ function onDraft(value: boolean) {
</div>

<div flex flex-col flex-1 overflow="hidden">
<ViewModuleGraph v-show="viewMode === 'graph'" :graph="graph" />
<div v-if="hasGraphBeenDisplayed" flex-1>
<ViewModuleGraph v-show="viewMode === 'graph'" :graph="graph" />
</div>
<ViewEditor v-if="viewMode === 'editor'" :key="current.filepath" :file="current" @draft="onDraft" />
<ViewConsoleOutput v-else-if="viewMode === 'console'" :file="current" />
<ViewReport v-else-if="!viewMode" :file="current" />
Expand Down