Skip to content

Commit

Permalink
Scope willRender to PageRenderer only
Browse files Browse the repository at this point in the history
The `willRender` property introduced to the generic `Renderer<E, S>`
only applies to the `PageRenderer` specialized sub-class. This commit
removes it from the root class and declares a
`PageRenderer.constructor()` method to accept and assign it.
  • Loading branch information
seanpdoyle committed Sep 14, 2023
1 parent 191c085 commit af0c77c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/core/drive/page_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export class PageRenderer extends Renderer {
}
}

constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {
super(currentSnapshot, newSnapshot, renderElement, isPreview)
this.willRender = willRender
}

get shouldRender() {
return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/frames/frame_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export class FrameController {

if (newFrameElement) {
const snapshot = new Snapshot(newFrameElement)
const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false)
const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false)
if (this.view.renderPromise) await this.view.renderPromise
this.changeHistory()

Expand Down
4 changes: 2 additions & 2 deletions src/core/frames/frame_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export class FrameRenderer extends Renderer {
}
}

constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {
super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender)
constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview) {
super(currentSnapshot, newSnapshot, renderElement, isPreview)
this.delegate = delegate
}

Expand Down
3 changes: 1 addition & 2 deletions src/core/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { Bardo } from "./bardo"
export class Renderer {
#activeElement = null

constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) {
constructor(currentSnapshot, newSnapshot, renderElement, isPreview) {
this.currentSnapshot = currentSnapshot
this.newSnapshot = newSnapshot
this.isPreview = isPreview
this.willRender = willRender
this.renderElement = renderElement
this.promise = new Promise((resolve, reject) => (this.resolvingFunctions = { resolve, reject }))
}
Expand Down

0 comments on commit af0c77c

Please sign in to comment.