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

Replace view/app/Query/query.tsx components to more 'reactive' components #502

Open
2 of 3 tasks
abelzis opened this issue Jan 9, 2024 · 0 comments
Open
2 of 3 tasks
Assignees
Labels
tech debt Technical debt

Comments

@abelzis
Copy link
Collaborator

abelzis commented Jan 9, 2024

In view/app/Query/query.tsx There are often some classes added to HTML elements, e.g. selected and then they're removed. It follows this syntax:

document.querySelectorAll('.autocomplete-list li')
        .item(0)
        .classList.add('selected');

which is not "reactive". The reactive way would be:
<CustomElement selected={isSelected} />
and the isSelected is a state element that would be modified in this way: setIsSelected(true).

There are other similar cases, where the code is vanilla js in a react environment.

So for this ticket:

  1. Start with the mentioned query.tsx file and find components (e.g. look at a function getFooterTag). This should be a component in QueryFooter.tsx.
  2. In the extracted component, replace the divs and other default html components with React components from Material UI which is already installed.
  3. Add a prop "selected" to the component. Handle the selection outside the component (in the query.tsx file).
  4. Go to step 1 and refactor other components.

Note: feel free to subdivide this ticket into smaller chunks. I would even suggest to start with a separate branch in a subticket, refactor single component and use it as an example for other components.

Edit: here's an example #508

Subtickets:

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

When branches are created from issues, their pull requests are automatically linked.

2 participants