-
-
Notifications
You must be signed in to change notification settings - Fork 185
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: nested search #105
feat: nested search #105
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/timc/kbar/GhqzoSSjFXxoNTQWBQ7x61f7rDdP |
f64d821
to
066250e
Compare
d1f2a11
to
6314bcc
Compare
066250e
to
fb976f9
Compare
fb976f9
to
3665431
Compare
// ensure that if the first item in the list is a group | ||
// name and we are focused on the second item, to not | ||
// scroll past that group, hiding 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.
👍
c1a97b2
to
6508290
Compare
@@ -19,14 +19,18 @@ export default function useStore(props: useStoreProps) { | |||
); | |||
} | |||
|
|||
const actionsInterface = React.useRef(new ActionInterface(props.actions)); |
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.
This was running new ActionInterface
on each render 🤦🏻♂️ we can either lazily initialize with useState
or useMemo
.
35d2ca7
to
9c944df
Compare
9c944df
to
7d4a33e
Compare
7d4a33e
to
4df68a0
Compare
1593cb5
to
ef339b5
Compare
ef339b5
to
4d3a49b
Compare
}, | ||
ref: React.Ref<HTMLDivElement> | ||
) => { | ||
const ancestors = React.useMemo(() => { |
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.
Could ancestors
not be provided by onRender
?
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.
We can but we will get this behavior, notice the slight bit of ancestor flash when we hit backspace and go to the parent action:
Kapture.2021-11-03.at.13.54.08.mp4
Since we throttle the matching, the actions displayed and the currentRootActionId
will not be synced perfectly. The current solution is to return the currentRootActionId
alongside the matches so we ensure they're synced:
const { results, rootActionId } = useDeepMatches();
I may be missing something totally here bc I really don't like returning that rootActionId
as part of useDeepMatches
lol
Closes #5.
Nested search begins only when a search query is present.