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

Title: Refactor Library.jsx for Better Maintainability and Performance #217

Open
dev-george-nikolaidis opened this issue Mar 11, 2024 · 7 comments
Labels
backend bug Something isn't working critical This is a critical issue or PR. devops This is a devops feature or issue enhancement New feature or request feature request this is a feature request frontend Work on Frontend fullstack good first issue Good for newcomers help wanted Extra attention is needed performance This is an issue related to the application performance usability This is related to UX or usability
Milestone

Comments

@dev-george-nikolaidis
Copy link
Contributor

Hello,

I've been working with Library.jsx and observed that its large size contributes to difficulty in maintenance, readability issues, and triggers unnecessary re-renders.

Suggestion:
Refactoring Library.jsx into smaller, component-based files could significantly enhance our codebase by improving readability, making maintenance easier, and potentially optimizing performance by reducing unnecessary re-renders.

Benefits:

  • Improved code readability
  • Easier maintenance
  • Better performance due to reduced unnecessary re-renders
  • Isolation of functionalities for easier updates and bug fixes

I believe this change could lead to more efficient development workflows and a more robust application. Looking forward to your thoughts and feedback on this proposal.

Best,
George

@gbowne1 gbowne1 added this to the Frontend milestone Mar 11, 2024
@gbowne1
Copy link
Owner

gbowne1 commented Mar 11, 2024

@dev-george-nikolaidis

I agree with this. The Library.jsx is quite large. If you would like to work on it I have some ideas and suggestions and you're welcome to make any improvements you see necessary. It does need extensive refactoring.

@gbowne1 gbowne1 added enhancement New feature or request help wanted Extra attention is needed frontend Work on Frontend feature request this is a feature request performance This is an issue related to the application performance usability This is related to UX or usability discussion This issue or PR needs more discussion labels Mar 11, 2024
@dev-george-nikolaidis
Copy link
Contributor Author

@gbowne1
What ideas and suggestions do you have in mind? Let's leave the issue open for new people ? If nobody wants to work on this, I will let you know to take it.

@gbowne1
Copy link
Owner

gbowne1 commented Mar 12, 2024

@dev-george-nikolaidis

My suggested improvements for Library.jsx would be listed in one of the current PRs as a comment:

#215 (comment)

Its unfinished code so the implementation needs to be completed but.. you can probably see where I was headed with that.

This reduces some of the import lines by grouping them together like the @mui imports currently listed over several lines

It also attempts to fix the useState imports, change some fo async functions and const arrow functions where necessary

Also its attempts to fix the returned components which make the code cluttered.

What ideas do you have?

@dev-george-nikolaidis
Copy link
Contributor Author

@gbowne1
I'm thinking about suggesting the use of the Higher-Order Component (HOC) pattern in React to break down our large Library.jsx into smaller, more manageable components. HOCs could help us encapsulate shared logic and make our codebase more modular and easier to maintain. It seems like a good way to improve reusability and organization, especially as our project grows. What do you think?

@gbowne1
Copy link
Owner

gbowne1 commented Mar 12, 2024

@dev-george-nikolaidis

Our code for Library.jsx is close to 900 lines.

What do you think of my idea?

However I am all for reuseable code and making it more maintainable

My other idea was to create imported js modules to extract the many functions and states we are using

We should also be looking at making use of more useState, useEffect, useRef, useMemo, useCallback, etc and others where they make sense but those are probably the most useful.

@dev-george-nikolaidis
Copy link
Contributor Author

@gbowne1
I like your idea. However, generally, it's not good to have many useEffects in one component for several reasons such as maintainability, readability, and performance. 900 lines is considered a large component in the context of React development in my opinion.

@gbowne1
Copy link
Owner

gbowne1 commented Mar 12, 2024

Ok. Well this issue is open.

@gbowne1 gbowne1 added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers devops This is a devops feature or issue frontend Work on Frontend feature request this is a feature request performance This is an issue related to the application performance and removed enhancement New feature or request help wanted Extra attention is needed frontend Work on Frontend feature request this is a feature request performance This is an issue related to the application performance usability This is related to UX or usability discussion This issue or PR needs more discussion labels Jun 22, 2024
@gbowne1 gbowne1 added usability This is related to UX or usability critical This is a critical issue or PR. backend fullstack labels Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working critical This is a critical issue or PR. devops This is a devops feature or issue enhancement New feature or request feature request this is a feature request frontend Work on Frontend fullstack good first issue Good for newcomers help wanted Extra attention is needed performance This is an issue related to the application performance usability This is related to UX or usability
Projects
Status: Todo
Development

No branches or pull requests

2 participants