Skip to content

Commit

Permalink
Use view to render frame missing message
Browse files Browse the repository at this point in the history
Also remove `invalidate` that has effectively been replaced.
  • Loading branch information
kevinmcconnell committed Feb 6, 2023
1 parent 4d6af03 commit 00a481e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/core/frames/frame_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,10 @@ export class FrameController
}

private handleFrameMissingFromResponse(fetchResponse: FetchResponse) {
this.renderFrameMissingError()
this.view.missing()
this.throwFrameMissingError(fetchResponse)
}

private renderFrameMissingError() {
this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`
}

private throwFrameMissingError(fetchResponse: FetchResponse) {
const message = `The response (${fetchResponse.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}">`
throw new TurboFrameMissingError(message)
Expand Down
4 changes: 2 additions & 2 deletions src/core/frames/frame_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { View, ViewRenderOptions } from "../view"
export type FrameViewRenderOptions = ViewRenderOptions<FrameElement>

export class FrameView extends View<FrameElement> {
invalidate() {
this.element.innerHTML = ""
missing() {
this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`
}

get snapshot() {
Expand Down

0 comments on commit 00a481e

Please sign in to comment.