Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/user data pagination #891

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

IshanVeer
Copy link

Date: 15/10/2024

Developer Name: Ishan Veer


Issue Ticket Number

832

Description

Previously all the data was being fetched at once which can cause performance issues. So things I worked on:

  1. I implemented pagination so that the first 10 users are fetched initially. As the user scrolls to the bottom of the page, an additional 10 users are fetched each time.
  2. The API was not paginated so currently tested with mock data and will be under feature flag.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1

Test Coverage

Screenshot 1 Screenshot 2024-10-15 at 7 59 30 PM Screenshot 2024-10-15 at 7 29 04 PM

Additional Notes

Currently testing it with mock data because API is still not paginated.

@pankajjs
Copy link

pankajjs commented Oct 15, 2024

  1. There are no tests for your changes.
  2. A working video would be better choice to see the working feature.

@vinit717 vinit717 linked an issue Oct 15, 2024 that may be closed by this pull request
10 tasks
Copy link
Member

@vinit717 vinit717 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put your feature behind feature flag also remove the mock data and comments
and what about the paginate API?

@IshanVeer
Copy link
Author

Please put your feature behind feature flag also remove the mock data and comments and what about the paginate API?

We had this conversation previously:
Screenshot 2024-10-14 at 10 06 33 PM

let showUser = 0;
usersData[activeTab] = await getUsers(activeTab);

// usersData[activeTab] = await getUsers(activeTab);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this if not needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently testing with mockdata and that function is still being used to fetch the actual data

Comment on lines +57 to +59
// createElement('span', {}, [
// user.first_name + ' ' + user.last_name + user.username,
// ]),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get rid of this if not needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, this is being currently used with the actual data I have just replicated my version to test out the mock data.

Comment on lines +32 to +34
return createElement('aside', { class: 'users_section' }, [
createElement('div', { class: 'loading' }, ['Loading...']),
]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not we create a common loader file? this can be re-used as well right?

Comment on lines 12 to 20
const debounce = (func, delay) => {
let timeoutId;
return function (...args) {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
func.apply(this, args);
}, delay);
};
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this into a separate file and export it and use here? this way if in future we need debounce in any other place, we can re-use

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this: removed this function as it is already defined globally in utils.js file in the root folder line:62

Comment on lines 51 to 52
} else {
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is else empty?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Implement pagination for dashboard users
4 participants