-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat: tree details page #96
Conversation
692744c
to
5058619
Compare
Nit: There is no need to use the word |
dashboard/src/routes/Trees/Trees.tsx
Outdated
<div className="flex w-2/3 px-6 items-center"> | ||
{/* placeholder for search */} | ||
{/* TODO: use i18n for the input placeholder */} | ||
<Input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can, it would be good to create a DebounInput
component that accepts the interval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I get your point, the DEBOUNCE_INTERVAL is being used in the const debouncedInput
that calls useDebounce
. The only function of the input here is to get the input value. How do you though in doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My ideia is a component like <DebounceInput onChange={...} interval={...} />
that holds the debounce logic (useDebounce) and calls onChange
only when needed respecting the debounce interval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and how would you make to get the value from the input to filter the page by it? also, we have to save all the data that the user type, just the filter value changes that will be updated later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we would use as
<DebounceInput
onChange={onInputSearchTextChange}
interval={debouncedInput}
/>
The onInputSearchTextChange
will be called respecting the debounce. That way we will not re-render the page on every key stroke just the DebounceInput
component.
The way it is know we are re-render the Trees
for every stroke (because it update the inputSearchText
state) and also for every debounce trigger (by updating debouncedInput
state)
dashboard/src/api/TreeDetails.tsx
Outdated
return res.data; | ||
}; | ||
|
||
export const useTreeDetail = (treeId: string): UseQueryResult => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const useTreeDetail = (treeId: string): UseQueryResult => { | |
export const useTreeDetails = (treeId: string): UseQueryResult<TreeDetails> => { |
so we can avoid data as TreeDetailsType
such as here
Left menu is not following the page scroll |
5058619
to
3d1aa1a
Compare
- add a router - remove app.css and app.tsx and use main.tsx instead - make a basic layout as a root - add a trees router
3d1aa1a
to
7cfc8c8
Compare
7cfc8c8
to
ba924a8
Compare
f47555a
to
4f97793
Compare
Description
Related Issues
How to test it
Visual reference