You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
It could be a bug. It could be a feature request. It could be neither.
Bug: What is the current behavior?
I'm not quite sure If I'm missing something, but I noticed that static methods on components that are connected to the instantsearch context are not being hoisted (copied over) to the composed component.
Here's a simplified example that hopefully illustrates the problem:
import{Component}from'react';import{connectStateResults}from'react-instantsearch/connectors';classMyComponentextendsComponent{// this won't be available on the "connected" componentstaticdoSomething(){}componentDidUpdate(prevProps){}render(){}}// exporting the connected component as defaultexportdefaultconnectStateResults(MyComponent)
When that component is imported somewhere else in the code, the static method of the composed/wrapped component won't be available:
importMyComponentfrom'./MyComponent';MyComponent.doSomething//=> undefined (should it be defined?)
Bug: What is the expected behavior?
Should static methods be hoisted/copied to the connected component as well?
Feature: What is your proposed API entry? The new option to add? What is the behavior?
I believe this is a common problem in the React ecosystem, and there are solutions out there to resolve this. For instance, hoist-non-react-statics.
There multiple ways to get around this issue, of course, but I think it would be very convenient to hoist the static methods. What do you think? Are there any downsides to doing so?
What is the version you are using? Always use the latest one before opening a bug issue.
5.0.1
The text was updated successfully, but these errors were encountered:
Indeed we don't support it because nobody ever asked for it (AFAIK). It could be convenient to implement it. I don't think that there is downside to this approach. But most of the time the static methods are used for data fetching since the lib handle this part, I don't have any case in mind where it might be interesting to hoist. Do you have some?
Do you want to request a feature or report a bug?
It could be a bug. It could be a feature request. It could be neither.
Bug: What is the current behavior?
I'm not quite sure If I'm missing something, but I noticed that static methods on components that are connected to the instantsearch context are not being hoisted (copied over) to the composed component.
Here's a simplified example that hopefully illustrates the problem:
When that component is imported somewhere else in the code, the static method of the composed/wrapped component won't be available:
Bug: What is the expected behavior?
Should static methods be hoisted/copied to the connected component as well?
Feature: What is your proposed API entry? The new option to add? What is the behavior?
I believe this is a common problem in the React ecosystem, and there are solutions out there to resolve this. For instance,
hoist-non-react-statics
.There multiple ways to get around this issue, of course, but I think it would be very convenient to hoist the static methods. What do you think? Are there any downsides to doing so?
What is the version you are using? Always use the latest one before opening a bug issue.
5.0.1
The text was updated successfully, but these errors were encountered: