diff --git a/src/public/app/widgets/type_property_widgets/link_map.js b/src/public/app/widgets/type_property_widgets/link_map.js index 1822ef40e..6d4d65ad7 100644 --- a/src/public/app/widgets/type_property_widgets/link_map.js +++ b/src/public/app/widgets/type_property_widgets/link_map.js @@ -29,6 +29,22 @@ export default class LinkMapWidget extends NoteContextAwareWidget { } async refreshWithNote(note) { + let shown = false; + + const observer = new IntersectionObserver(entries => { + if (!shown && entries[0].isIntersecting) { + shown = true; + this.displayLinkMap(note); + } + }, { + rootMargin: '0px', + threshold: 0.1 + }); + + observer.observe(this.$widget[0]); + } + + async displayLinkMap(note) { this.$widget.html(TPL); const $linkMapContainer = this.$widget.find('.link-map-container');