Skip to content

Commit 937533b

Browse files
committed
This is a better way to hide the loading indicator.
1 parent cd9474f commit 937533b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

FrontEnd/scripts/controllers/readme_controller.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,15 @@ export class ReadmeController extends Controller {
3636
chartContainer.classList.add('mermaid-chart')
3737
mermaidDataElement.appendChild(chartContainer)
3838

39-
// The documentation says not to call `initialize` more than once, but it is the
40-
// only way to switch themes and it's the only way to get this working.
39+
// The documentation says not to call `initialize` more than once. That said, it's
40+
// the only way to switch themes and therefore the only way to get this working.
4141
mermaid.initialize({ theme: 'default', nodeSpacing: 50, rankSpacing: 50, curve: 'basis' })
4242
const lightRenderResult = await mermaid.render(`mermaid-chart-light-${index}`, chartDefinition)
4343
chartContainer.insertAdjacentHTML('beforeend', lightRenderResult.svg)
4444

4545
mermaid.initialize({ theme: 'dark', nodeSpacing: 50, rankSpacing: 50, curve: 'basis' })
4646
const darkRenderResult = await mermaid.render(`mermaid-chart-dark-${index}`, chartDefinition)
4747
chartContainer.insertAdjacentHTML('beforeend', darkRenderResult.svg)
48-
49-
// Clean up the superfluous loading element.
50-
const loadingElement = mermaidSectionElement.querySelector('.js-render-enrichment-loader')
51-
if (!loadingElement) continue
52-
loadingElement.remove()
5348
}
5449
}
5550

FrontEnd/styles/readme.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@
146146
}
147147

148148
section[data-type='mermaid'] {
149-
pre {
149+
pre,
150+
.js-render-enrichment-loader {
150151
display: none;
151152
}
152153

0 commit comments

Comments
 (0)