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

refactor(to discuss): large list optimisation #63

Open
wit03 opened this issue Oct 9, 2024 · 0 comments
Open

refactor(to discuss): large list optimisation #63

wit03 opened this issue Oct 9, 2024 · 0 comments

Comments

@wit03
Copy link
Member

wit03 commented Oct 9, 2024

          _:hammer_and_wrench: Refactor suggestion_

Consider performance optimization for large lists.

The overall implementation of the ListCard component is well-structured and follows good practices. However, for potentially large lists, you might want to consider implementing virtualization to improve performance.

You could use a library like react-window or react-virtualized to efficiently render large lists. This would involve changing the table structure to a virtualized list, but it could significantly improve performance for lists with many items.

Here's a basic example of how you might start implementing this with react-window:

import { FixedSizeList as List } from 'react-window';

// ... (inside your component)
const Row = ({ index, style }) => {
  const item = currentItems[index];
  return (
    <div style={style}>
      {/* Render your item here, similar to your current table row */}
    </div>
  );
};

return (
  <List
    height={400} // Adjust based on your needs
    itemCount={currentItems.length}
    itemSize={35} // Adjust based on your row height
    width="100%"
  >
    {Row}
  </List>
);

This is just a starting point and would need to be adapted to your specific use case and styling requirements.

Originally posted by @coderabbitai[bot] in #46 (comment)

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

No branches or pull requests

1 participant