Skip to content

feat: improve references search#107

Merged
sergioramos merged 14 commits into
mainfrom
106-improve-references-search
Jun 9, 2023
Merged

feat: improve references search#107
sergioramos merged 14 commits into
mainfrom
106-improve-references-search

Conversation

@sehyod

@sehyod sehyod commented Jun 7, 2023

Copy link
Copy Markdown
Collaborator

Fixes #106
This enables searching references by title and author names in the reference selector.
This also uses fuse.js library to implement fuzzy search. The search options can easily be configured in the corresponding atom

@sehyod sehyod requested a review from cguedes June 7, 2023 16:08

@cguedes cguedes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure an atom should be used here.

Comment thread src/atoms/referencesState.ts Outdated
Comment on lines +31 to +36
export const getReferencesFuseAtom = atom(
(get) =>
new Fuse(get(getReferencesAtom), {
keys: ['title', 'authors.fullName'],
}),
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think this should be an atom? I can only think of keeping the instance alive and therefore performance, but for that we might use a UseRef in the react component (this is a UI concern).
Another though is about (underlying) references getting updated and the atom being the best solution.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you're right, there are no particular to use an atom here. Beside, I think this creates a new instance every time we read the atom so it does not even keep the instance alive

Comment thread src/TipTapEditor/ReferenceNode/ReferencesList.tsx Outdated
sehyod and others added 6 commits June 9, 2023 10:57
* feat: Add AI interaction for text rewrite (#60)

* linter fix

* Fix unit test reading OPENAI_API_KEY with .get

* Adjust AI View to use rewrite sidecar command

* Use `self.n_options` instead of hard-coded 1

* Create useCallablePromise and improve code

* remove unused dependencies

---------

Co-authored-by: Carlos Guedes <[email protected]>
Co-authored-by: Carlos Guedes <[email protected]>
@cguedes cguedes self-requested a review June 9, 2023 10:33
cguedes
cguedes previously approved these changes Jun 9, 2023
@cguedes cguedes self-requested a review June 9, 2023 11:10
@sergioramos sergioramos merged commit b3a34f9 into main Jun 9, 2023
@sergioramos sergioramos deleted the 106-improve-references-search branch June 9, 2023 11:11
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.

Improve search in the references selector

4 participants