mirror of
https://github.com/wassname/talk.git
synced 2026-08-01 13:00:55 +08:00
connect aware "excludeIf" using our own hoc
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import withFragments from 'coral-framework/hocs/withFragments';
|
||||
import excludeIf from 'coral-framework/hocs/excludeIf';
|
||||
import connect from 'coral-framework/hocs/connect';
|
||||
import Tab from '../components/Tab';
|
||||
|
||||
// TODO: This is just example code, and needs to replaced by an actual implementation.
|
||||
const enhance = compose(
|
||||
connect((state) => ({
|
||||
stream: state.stream,
|
||||
})),
|
||||
withFragments({
|
||||
asset: gql`
|
||||
fragment TalkFeatured_Tab_asset on Asset {
|
||||
@@ -13,7 +17,9 @@ const enhance = compose(
|
||||
}
|
||||
}`,
|
||||
}),
|
||||
excludeIf((props) => props.asset.recentComments.length === 0)
|
||||
excludeIf((props) => {
|
||||
return props.asset.recentComments.length === 0;
|
||||
})
|
||||
);
|
||||
|
||||
export default enhance(Tab);
|
||||
|
||||
Reference in New Issue
Block a user