Commit d8c58a8a authored by aleclofabbro's avatar aleclofabbro

fixed joined communities limit var binding and restored loadmore on sidebar

parent bb7826c7
......@@ -13,7 +13,11 @@ import * as ApolloReactHooks from '@apollo/react-hooks';
export type MyCommunityFollowsQueryVariables = {};
export type MyCommunityFollowsQueryVariables = {
limit?: Types.Maybe<Types.Scalars['Int']>,
before?: Types.Maybe<Array<Types.Scalars['Cursor']>>,
after?: Types.Maybe<Array<Types.Scalars['Cursor']>>
};
export type MyCommunityFollowsQuery = (
......@@ -64,7 +68,7 @@ export const MyCommunityFollowsDataFragmentDoc = gql`
fragment MyCommunityFollowsData on Me {
user {
id
communityFollows {
communityFollows(limit: $limit, before: $before, after: $after) {
totalCount
pageInfo {
...FullPageInfo
......@@ -83,7 +87,7 @@ export const MyCommunityFollowsDataFragmentDoc = gql`
${FullPageInfoFragmentDoc}
${MyFollowedCommunityDataFragmentDoc}`;
export const MyCommunityFollowsDocument = gql`
query myCommunityFollows {
query myCommunityFollows($limit: Int, $before: [Cursor!], $after: [Cursor!]) {
me @connection(key: "myCommunityFollows") {
...MyCommunityFollowsData
}
......@@ -102,6 +106,9 @@ export const MyCommunityFollowsDocument = gql`
* @example
* const { data, loading, error } = useMyCommunityFollowsQuery({
* variables: {
* limit: // value for 'limit'
* before: // value for 'before'
* after: // value for 'after'
* },
* });
*/
......
query myCommunityFollows {
query myCommunityFollows($limit:Int, $before:[Cursor!], $after:[Cursor!]){
me @connection(key: "myCommunityFollows"){
...MyCommunityFollowsData
}
......@@ -8,7 +8,7 @@ query myCommunityFollows {
fragment MyCommunityFollowsData on Me {
user{
id
communityFollows{
communityFollows(limit:$limit, before:$before, after:$after) {
totalCount,
pageInfo{ ...FullPageInfo }
edges{
......
......@@ -3,16 +3,18 @@ import * as GQL from './myFollowedCommunities.generated';
import { usePage } from 'fe/lib/helpers/usePage';
// import { DEFAULT_PAGE_SIZE } from 'mn-constants';
const MY_JOINMED_LIST_LIMIT = 15; // TODO CONFIGURE
export const useMyFollowedCommunities = () => {
const myFlwCommunitiesQ = GQL.useMyCommunityFollowsQuery({
variables: { limit: 10 } // FIXME
variables: { limit: MY_JOINMED_LIST_LIMIT }
});
const myCommunityFollowsPage = usePage(
myFlwCommunitiesQ.data?.me?.user.communityFollows,
({ cursor, update }) => {
return myFlwCommunitiesQ.fetchMore({
variables: { ...cursor, limit: 10 }, // FIXME CONFIGURE
variables: { ...cursor, limit: MY_JOINMED_LIST_LIMIT },
updateQuery: (prev, { fetchMoreResult }) => {
return fetchMoreResult?.me?.user?.communityFollows &&
prev.me?.user?.communityFollows
......
......@@ -12,6 +12,7 @@ import Avatar from 'ui/elements/Avatar';
import { my_timeline, logo_small_url } from '../../../mn-constants';
// const MnetLogo = require('static/img/logo-icon.png');
import { FormikHook } from 'ui/@types/types';
import { LoadMore } from '../Loadmore';
// import { LoadMore } from 'ui/modules/Loadmore';
export enum Status {
......@@ -225,9 +226,9 @@ export const Sidebar: React.FC<Props> = props => {
</CommunityLink>
)
)}
{/* {props.LoadMoreFormik && (
{props.LoadMoreFormik && (
<LoadMore LoadMoreFormik={props.LoadMoreFormik} />
)} */}
)}
</Nav>
</>
</SidebarOverflow>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment