friendsofagape / usfm-editor

A React component for WYSIWYG USFM editing.
https://friendsofagape.github.io/usfm-editor/
MIT License
5 stars 1 forks source link

USFM ID Manipulation #29

Open Ashersam opened 3 years ago

Ashersam commented 3 years ago

build tool

Next.js

Usfm Editor version

0.8.0

Reproduction repository

https://github.com/friendsofagape/autographa/blob/notification/renderer/src/components/EditorPage/UsfmEditor/UsfmEditor.js#L263

Issue Description

Some time while I navigate through books and get the output of usfm. The output usfm string has an id of the previous book and hence ends up in the wrong usfm output file for that particular book. Surprisingly the book fetch on navigation works fine without any errors

https://user-images.githubusercontent.com/38970117/132307718-aa140cac-5004-4517-85dd-45f1c24f8c57.mp4

aunger commented 3 years ago

Thanks, @Ashersam! I think your application might have set up a kind of feedback loop where you have the editor's onIdentificationChange wired to update the identification prop on the editor, and around and around.

I'd try to break this loop, maybe by deleting line 346 (link).

aunger commented 3 years ago

I see now that it's not obvious, but you don't need to use the identification prop if you're passing in USFM that specifies the correct identification headers. You could use that prop either for creating a new USFM file, or for updating the headers on the editor contents programmatically.

Ashersam commented 3 years ago

I see now that it's not obvious, but you don't need to use the identification prop if you're passing in USFM that specifies the correct identification headers. You could use that prop either for creating a new USFM file or for updating the headers on the editor contents programmatically.

oh, that makes sense thanks @aunger I will try removing the since we are not editing id inside the editor.