aertslab / SCope

Fast visualization tool for large-scale and high dimensional single-cell data
GNU General Public License v3.0
68 stars 15 forks source link

Selecting a regulon causes an infinite loop in the backend #435

Closed KrisDavie closed 3 years ago

KrisDavie commented 3 years ago

After selecting a regulon on the regulon tab, after loading the 3 plotsm the backend ends up in a (possibly) infinite loop reloading the loom file and causes performance issues.

dweemx commented 3 years ago

This issue is not trivial and is in fact a double infinite loop each triggered by a listener function call.

When a user select a result from the Search results, it dispatches the following action: https://github.com/aertslab/SCope/blob/3821798914b3fefaf2722c74a736e16a335451a0/src/components/Search/FeatureSearchBox.tsx#L117

This will render the FeatureSearchBox component and since selected is now defined, Legacy.updateFeature will be called: https://github.com/aertslab/SCope/blob/3821798914b3fefaf2722c74a736e16a335451a0/src/components/Search/FeatureSearchBox.tsx#L158-L164

The two problematic listeners are getting called inside setActiveFeature function: https://github.com/aertslab/SCope/blob/69a2bff27e8452810bcee69d8b2bee117990224b/src/components/common/API.jsx#L424-L428 and are the following:

Each of them will trigger a re-render of FeatureSearchBox and since !R.equals(currentFeature, legacyFeature) is true: image

hence the infinite loop

MaybeJustJames commented 3 years ago

Fixed in #451