diff --git a/src/app/profiles/App/SimilarProfiles/SimilarProfiles.tsx b/src/app/profiles/App/SimilarProfiles/SimilarProfiles.tsx index 2b1d29b15..b1e7657b1 100644 --- a/src/app/profiles/App/SimilarProfiles/SimilarProfiles.tsx +++ b/src/app/profiles/App/SimilarProfiles/SimilarProfiles.tsx @@ -21,8 +21,8 @@ interface SimilarProfilesProps { loading?: boolean; similarContributors: StatefulContributor[]; contributors: StatefulContributor[]; - subscribe: (contributor: StatefulContributor) => void; - unsubscribe: (contributor: StatefulContributor) => void; + subscribe: (contributor: StatefulContributor) => () => void; + unsubscribe: (contributor: StatefulContributor) => () => void; className?: string; } @@ -77,8 +77,8 @@ const SimilarProfiles = ({ subscribe(contributor)} - onUnsubscribe={() => unsubscribe(contributor)} + onSubscribe={subscribe(contributor)} + onUnsubscribe={unsubscribe(contributor)} to={pathToContributor(contributor)} /> ))} diff --git a/src/app/profiles/App/SimilarProfiles/withConnect.ts b/src/app/profiles/App/SimilarProfiles/withConnect.ts index 057427c77..d9bc315a6 100644 --- a/src/app/profiles/App/SimilarProfiles/withConnect.ts +++ b/src/app/profiles/App/SimilarProfiles/withConnect.ts @@ -13,8 +13,8 @@ import { extensionMessageSender } from 'app/profiles/extensionId'; export interface ConnectedSimilarProfileProps extends RouteComponentProps<{ id: string }> { - subscribe?: (contributor: Contributor) => void; - unsubscribe?: (contributor: Contributor) => void; + subscribe?: (contributor: Contributor) => () => void; + unsubscribe?: (contributor: Contributor) => () => void; } const mapStateToProps = ( @@ -27,9 +27,9 @@ const mapStateToProps = ( }); const mapDispatchToProps = (dispatch: Dispatch) => ({ - subscribe: (contributor: Contributor) => + subscribe: (contributor: Contributor) => () => dispatch(subscribe(contributor.id, { receiver: extensionMessageSender })), - unsubscribe: (contributor: Contributor) => + unsubscribe: (contributor: Contributor) => () => dispatch(unsubscribe(contributor.id, { receiver: extensionMessageSender })) });