Mobile: Fixes: #10677: Following a link to a previously open note wouldn't work #10750
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #10677
Description
A common source of problems in mobile seems to be that the
NoteScreenComponent
needs a lot of "hacks" to be able to change from one note content to another.In this issue I'm addressing the latest bug reported that has a similar source of problem.
The original problem was reported that following a link from A -> B -> A would make the link to B stop working, when note A and B where on different notebooks
I'm not 100% sure of the root cause, but the reason is that when we render A and B for the first time there is a call to
componentDidMount
which callsnote-screen-shared
initState
which loads the note by theprops.noteId
propertyBut when following the link from B -> A, now A doesn't reload the
this.state.note
, which would result on the navigation sending the user to the B notebook and trying to open the A note.To fix this, I added a wrapper to the component that will be re-rendered every time the
noteId
changes, making it unnecessary the "hack" of redirecting to Notes and after a timeout redirect to Note.Testing
Preparation
Testing