Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
ChapterEditor responds to changes to usfmString prop (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
KJoslyn committed Jun 18, 2021
1 parent d48ee82 commit 2b1170b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/ChapterEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ export class ChapterEditor<W extends UsfmEditorRef>
}

componentDidMount(): void {
if (this.props.goToVerse) {
this.goToVerse(this.props.goToVerse)
}
this.goToVerse(this.props.goToVerse || ChapterEditor.defaultGoToVerse)
}

componentDidUpdate(prevProps: UsfmEditorProps): void {
if (
if (!isEqual(prevProps.usfmString, this.props.usfmString)) {
this.wholeBookUsfm = this.props.usfmString
this.goToVerse(
this.props.goToVerse || ChapterEditor.defaultGoToVerse
)
} else if (
!isEqual(prevProps.goToVerse, this.props.goToVerse) &&
this.props.goToVerse
) {
Expand Down

0 comments on commit 2b1170b

Please sign in to comment.