Open Azad99-9 opened 5 months ago
@aashimawadhwa @rishav-jha-mech @DMills27 PTAL and comment
@xoldd This was discussed frequently in the past, however related to news feeds. PTAL too
@Azad99-9 @meetulr Do you think this can be implemented without the UI/UX functionality being affected for both Admin and Mobile?
@palisadoes For the mobile part the UI should be tweaked to accomodate the pagination.
Both the admin and mobile will need to be updated simultaneously according to the changes in the API. We'll need contributors for both. Would depend on how the query is modified in the backend. A proper approach should be established first.
Would depend on how the query is modified in the backend. A proper approach should be established first.
I've documented the standard approach to be followed throughout talawa-api for implementing pagination using the graphql connections:- https://docs.talawa.io/docs/developers/talawa-api/pagination
Implement pagination for EventsByOrganization
Again, REST like patterns should not to be followed with graphql, relationships and fetching patterns should be expressed in the graph. This is an anti-pattern:-
type Query {
eventsByOrganization(organizationID: ID!): EventsConnection
}
The events associated to an organization should be exposed like this:-
type Organization {
events: EventsConnection
}
On the client side querying for the events within an organization would look like this:-
type OrganizationEventsQuery($cursor: String, $limit: Int!, $organizationID: ID!) {
organization(id: $organizationID) {
address
phoneNumber
events(first: $limit, after: $cursor) {
edges {
cursor
node {
id
...other event fields
}
}
pageInfo {
... fields
}
}
}
name
}
The advantage here is that you can fetch other fields like address
, phoneNumber
, name
etc., that exist on the organization along with the events associated to that organization. This is more efficient because the client only sends 1 network request to fetch everything that is needed. The server takes care of resolving everything listed in the query.
When the next set of events are to be fetched(connection is to be traversed further) a new network request would be made with a non-null value for the $cursor
variable. This time there's no need to fetch the organization fields like address, phoneNumber, name etc., because they were already fetched by the very first network request. This would look like this:-
type OrganizationEventsQuery($cursor: String, $limit: Int!, $organizationID: ID!) {
organization(id: $organizationID) {
events(first: $limit, after: $cursor) {
edges {
cursor
node {
id
...other event fields
}
}
pageInfo {
... fields
}
}
}
}
To understand how the client implementation would work, take a read:-
When the next set of events are to be fetched(connection is to be traversed further) a new network request would be made with a non-null value for the $cursor variable. This time there's no need to fetch the organization fields like address, phoneNumber, name etc., because they were already fetched by the very first network request. This would look like this:-
Yes we already use a similar approach in organizationsConnection
query.
@Azad99-9 Are you working on this?
@palisadoes I am not working on this. But this needs to be addressed. To resolve client side performance issues.
Should I do it?
Yes kindly do it. Thanks.
hey, is this issue up? can i be assigned to do this?.
@Maniii97 Thank you for your interest. Please keep looking, as I'm sure we have open issues and we'd love your help. If any issue is already assigned, please don't ask to be assigned. We want everyone to get a chance.
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
Please assign me this issue, I would like to work on this.
@xoldd Are you working on this?
@xoldd Are you working on this?
I had made a PR that incorporated the required changes but it was failing the prettier formatting test which I wasn't able to fix on my local system. So, Peter closed the PR. I'm currently not working on this anymore so you can assign it to @AnshulKahar2729.
@AnshulKahar2729 You can reference my PR and make a similar PR.
@xoldd Are you working on this?
I had made a PR that incorporated the required changes but it was failing the prettier formatting test which I wasn't able to fix on my local system. So, Peter closed the PR. I'm currently not working on this anymore so you can assign it to @AnshulKahar2729.
@AnshulKahar2729 You can reference my PR and make a similar PR.
Ok I will do that
@xoldd Are you working on this?
I had made a PR that incorporated the required changes but it was failing the prettier formatting test which I wasn't able to fix on my local system. So, Peter closed the PR. I'm currently not working on this anymore so you can assign it to @AnshulKahar2729.
@AnshulKahar2729 You can reference my PR and make a similar PR.
Ok I will do that
Working on this... Will soon raise a PR.
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
Working....
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
working
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
Working on this... I am just solving another issue too.
Unassigning. Inactivity
can i work on this issue? @palisadoes currently learning the tools and exploring talawa softwares. this would help me learn more!
This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.
unassigning. inactivity
Hey @palisadoes, I would like to on this. Can you assign this to me :)
Hi @palisadoes, I’d like to take on this issue and implement the suggested pagination for the EventsByOrganization query.
Proposed Steps: Fetch event entries batch-wise to improve API performance and reduce loading times. Display events with pagination to manage and navigate entries more effectively.
Thank you!
Is your feature request related to a problem? Please describe. Currently the
EventsByOrganization
query fetches all event entries at once. The number of event entries in the database has drastically increased after adding the Recurring events feature. This has resulted in slow API fetching times.Describe the solution you'd like Implement pagination for EventsByOrganization. This will allow fetching events in smaller, manageable sets based on user needs (e.g., number of events per page).
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Approach to be followed (optional) A clear and concise description of approach to be followed.
Additional context Add any other context or screenshots about the feature request here.
Potential internship candidates Please read this if you are planning to apply for a Palisadoes Foundation internship https://github.com/PalisadoesFoundation/talawa/issues/359