web-clipper: prevent cloning when clipping to an existing note + optimizations#8894
web-clipper: prevent cloning when clipping to an existing note + optimizations#8894contributor wants to merge 6 commits intoTriliumNext:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue in the web clipper where re-clipping a URL to an already existing note would incorrectly create a clone of that note, often cluttering the clipper inbox. The modification ensures that when an existing URL is clipped again, new content is appended to the original note, regardless of its current location, thereby preventing unintended duplication and maintaining an organized inbox. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request removes the logic that automatically clones a note to the clipper inbox when content is appended to it. This change addresses an issue where notes that were moved out of the inbox would be cloned back, cluttering the inbox. The removal of the cloning code is a direct and effective fix for the described problem.
…ctly) instead of (misnamed) note.searchNotesInSubtree method
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request primarily refactors the note clipping functionality by replacing the cloneService with a new searchService for finding existing clipping notes. The findClippingNote function was updated to use this global searchService and no longer requires a clipperInboxNote parameter. Consequently, the addClipping, createNote, and findNotesByUrl functions were adjusted to call the updated findClippingNote signature. The clipperInbox note is now only fetched when a new clipping note needs to be created, optimizing its retrieval. Additionally, the logic for appending content to existing #clipType=clippings notes with matching pageUrl attributes has been clarified in comments, and a minor formatting adjustment was made in the openNote function.
This removes undesired note cloning when clipping to existing note
Background
I noticed lot of cloned notes in clipper inbox appeared periodically. I blamed sync, but it turned out to be web clipper handler bug/feature.
The cloning was introduced in https://github.com/TriliumNext/Trilium/pull/4075/changes
But this does not works properly in my opinion:
Proposed solution
Additional refactoring made
Finding clipping note code is now more correct semantically (uses
searchService.searchNotesmethod instead of misleading indirection vianote.searchNotesInSubtreemethod. As a bonus, it saves extra call togetClipperInboxNoteon each click on browser extension, and in case of clipping selection to an exiting note.