Hypertopic / LaSuli

Social annotation for qualitative analysis
https://hypertopic.org/lasuli
GNU General Public License v3.0
12 stars 4 forks source link

Fragments aren't drawn in the correct tab #58

Closed gnoxr closed 5 years ago

gnoxr commented 6 years ago

Steps to reproduce

How to fix

(Warning: unreadable technical stuff).

Injection of the highlighting script is done by the Display component (src/sidebar/jsx/Display.jsx), in order to fulfill the requirement "show highlights whenever the sidebar is open". The private _loadScript() method asks the browser for the current active tab. When the current active tab is not the good one, this bug happens.

Loading the Display component is therefore done by the Sidebar component (src/sidebar/sidebar.jsx), in the getContent() method, called for every this.setState({…}); occurrence.

The one we're interested in is located near the end of the _updateContent() private method, as a callback to the getResource browser call (to the model script).

There is a tab change listener in the componentDidMount() React method. I will dig into it this weekend, but a fix would be to find a non-ugly way to store the tab id in _updateContent() to pass it to Display (why not through the component's state).

benel commented 5 years ago

@gnoxr Any news?

benel commented 5 years ago

@gnoxr Any news?

franck-eyraud commented 5 years ago

The above commit attaches the components to a tabId, it seems more logical and should fix this issue. To be confirmed.