Open carlosmbe opened 1 year ago
I believe this has been an issue for quite some time (though I can't find an issue for it, if one existed). Note that if you make any changes to the Form (not just name), the Dialog title gets updated.
Likely will be fixed by migrating off backbone
I believe the issue is regarding BackBone events.
(Correct me if I'm wrong) We currently rely on BackBone events to monitor and perform callbacks when an event is triggered.
However, even when used in a useEffect()
or similar hook, either the change to the resource happens after the re-render is triggered, or some BackBone's implementation of events does not work well with React hooks.
I think the issue is that we don't have a useEffect() at all in this place and are using resource.get('') directly inside of component render (I might be wrong, I didn't look at the code) - which is intuitive, but causes a bug.
rather than fixing this place (and many more places that have a similar issue), we should just migrate to a new resource ORM, where resource changes trigger react re-render
Ah, I see now (maybe)!
For the ResourceView, we are getting the title from the useResourceView
hook.
There is a useEffect()
in the hook, but not on the Resource View component.
I'm assuming the 'fix' for this would be to create a useEffect()
hook in ResourceView that forces a re-render when the 'title' value from the useResourceView hook changes. Although it does seem slightly redundant, it makes sense if this is the case :sweat_smile:
Can recreate in edge (7.9.6)
Describe the bug The Title in the Editor lags a single character behind the actual field when being changed
To Reproduce Steps to reproduce the behavior:
Name
and see observe the title reactsExpected behavior Would be great if they were in sync
Screen Recording
https://github.com/specify/specify7/assets/53784701/17cf9f0e-207f-4a4e-a3d4-295ddd5d6563
Desktop: