Skip to content

Fix TypeErrors when opening a parent with a highlighted element

Erwan Rouchet requested to merge typeerror-parent-highlight into master

Closes #1036 (closed)

I first fixed the three TypeErrors that were showing up simultaneously when following the steps described in the issue.

The fix caused strange animation issues, where when switching to a parent, the details panel would do its close animation and then reopen itself immediately after, because the transition depended on both whether the details panel was to be shown, and whether the corpus ID was set. I removed the corpus ID requirement so that the panel would instead stay open and show a loading state.

This however required updating the DetailsPanel and the PanelHeader so that they handle a "corpusId is null" scenario properly, as this was causing even more TypeErrors to show up.

After all of those fixes, I managed to find the actual root cause of this issue: elements/getParentsBulk, used to detect where a highlighted child is in the element's tree when starting from scratch, uses with_corpus: false but does not manually set a corpus. I added a corpus parameter to that action and did the necessary updates to get the corpus to be added, but still noticed that my previous fixes for the TypeErrors were still relevant, as the corpus ID can still become null or undefined when switching pages, for example when using the Back button of the browser, so those fixes will stay.

Merge request reports

Loading