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

GSoC22: Refactoring and Code Quality #53

Merged
merged 3 commits into from Jul 1, 2022
Merged

Conversation

yahia3200
Copy link
Contributor

Introduction

This is my first GSoC22 contribution to the project. This PR focus on improving the code quality of the project so the maintenance and adding new features to the project be much easier. This PR includes the following:

Bug Fixes

Can't clear filter created on Pie Chart

Before

error1

After

fix1

The Pie Chart doesn't load filters on reload

Before

error2

After

fix2

Components don't render when resizing

Before

error3

After

fix3

Update used packages

updating the packages that use unsafe component lifecycles such as react-resizable and react-grid-layout

image

Rewrite Most Of The Components To A Functional Style

Updating most of the components to use the new functional style of React and hooks. The functional style is easier to read and it produces less code. It also eliminates the usage of this and bind keywords.

Move Config and App Data To A Global State

Using the Context API now the config, data, filters and filtered data are accessible globally to all the components in the app, this is useful to avoid props drilling and this will enable us to add the ability for the user to change some of the configurations from the app GUI., for example, the config data can be accessed as follows
const { config, configLoading, configError } = useContext(ConfigContext);

Abstracting The Data Fetching Logic

Creating a custom-created React hook useFetch to handle all fetch requests in the app. This hook can be used as follows
const { error, data, isPending } = useFetch(URL);

Adding ESLint To The Project

Adding a static code analyzer is very important as it makes the coding style consistent in all code files and it helps to avoid any potential bug in the code

I configured the ESLint tool with React plugin: https://github.com/jsx-eslint/eslint-plugin-react
With Airbnb code style guide: https://github.com/airbnb/javascript
I fixed all linting issues in the code except the files in the experimental folder which I created to contain the files that aren't used currently in the project

Removing The Build Files From Git Tracking

@birm birm self-requested a review June 27, 2022 15:01
@birm birm merged commit 562dc3a into sharmalab:gsoc22 Jul 1, 2022
@yahia3200 yahia3200 changed the title Gsoc22: Refactoring and Code Quality GSoC22: Refactoring and Code Quality Sep 2, 2022
@birm birm mentioned this pull request Sep 6, 2022
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.

None yet

2 participants