Skip to content

Commit

Permalink
fix: remove lazy loading of Main
Browse files Browse the repository at this point in the history
The race conditions were fixed from two previous commits
  • Loading branch information
aminya committed Dec 26, 2020
1 parent 4d9e234 commit 6ad19cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/minimap-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CompositeDisposable, Disposable } from 'atom'
import { EventsDelegation, AncestorsMethods } from 'atom-utils-plus'
import elementResizeDetectorImport from 'element-resize-detector'

import * as Main from './main'
import DOMStylesReader from './mixins/dom-styles-reader'
import CanvasDrawer from './mixins/canvas-drawer'
import include from './decorators/include'
Expand All @@ -13,7 +14,6 @@ import MinimapQuickSettingsElement from './minimap-quick-settings-element'
const elementResizeDetector = elementResizeDetectorImport({ strategy: 'scroll' })

let overlayStyle
let Main // TODO: lazy loaded because of race confitions

const ensureOverlayStyle = () => {
if (!overlayStyle) {
Expand Down Expand Up @@ -685,8 +685,6 @@ class MinimapElement {
* @return {Minimap} this element's Minimap
*/
setModel (minimap) {
if (!Main) { Main = require('./main') }

this.minimap = minimap
this.subscriptions.add(this.minimap.onDidChangeScrollTop(() => {
this.requestUpdate()
Expand Down
4 changes: 1 addition & 3 deletions lib/mixins/canvas-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import { escapeRegExp } from 'underscore-plus'
import Mixin from 'mixto'

import * as Main from '../main'
import CanvasLayer from '../canvas-layer'

let Main // TODO: lazy loaded because of race confitions

/**
* The `CanvasDrawer` mixin is responsible for the rendering of a `Minimap`
Expand Down Expand Up @@ -328,7 +328,6 @@ export default class CanvasDrawer extends Mixin {
*/
drawBackDecorationsForLines (firstRow, lastRow, offsetRow) {
if (firstRow > lastRow) { return }
if (!Main) { Main = require('../main') }

const devicePixelRatio = this.minimap.getDevicePixelRatio()
const lineHeight = this.minimap.getLineHeight() * devicePixelRatio
Expand Down Expand Up @@ -375,7 +374,6 @@ export default class CanvasDrawer extends Mixin {
*/
drawFrontDecorationsForLines (firstRow, lastRow, offsetRow) {
if (firstRow > lastRow) { return }
if (!Main) { Main = require('../main') }

const devicePixelRatio = this.minimap.getDevicePixelRatio()
const lineHeight = this.minimap.getLineHeight() * devicePixelRatio
Expand Down

0 comments on commit 6ad19cc

Please sign in to comment.