v3.6.18#321
Conversation
…oups (#318) Store lastFrontmatter immediately on any frontmatter change (not just when banner-relevant fields change) so subsequent comparisons have a correct baseline. Add banner-relevant field filtering to the resolved handler to prevent unnecessary re-renders. Clear lastFrontmatter cache on settings save alongside other caches.
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 delivers a patch release, version 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 addresses a banner flickering issue (issue #318) by refining how frontmatter changes are detected in metadataCache event listeners. The core logic change appears sound and correctly prevents unnecessary banner updates on every keystroke.
My review includes a few suggestions:
- Correcting a typo in the date and removing a duplicated entry in the changelog files.
- A refactoring suggestion for
src/core/pixelBannerPlugin.jsto address significant code duplication between two event handlers. This will improve the maintainability of the code.
The version bumps and test file updates are all appropriate for this change.
|
|
||
| All notable changes to the Pixel Banner plugin will be documented in this file. | ||
|
|
||
| ### v3.6.18 - 2026-03-08 |
| ### v3.6.18 - 2026-03-08 | ||
| #### 🐛 Fixed | ||
| - Fixed banner flickering on every keystroke when a note contains frontmatter and uses folder group banners (issue #318) | ||
|
|
| const relevantFields = [ | ||
| ...this.settings.customBannerField, | ||
| ...this.settings.customYPositionField, | ||
| ...this.settings.customXPositionField, | ||
| ...this.settings.customContentStartField, | ||
| ...this.settings.customImageDisplayField, | ||
| ...this.settings.customImageRepeatField, | ||
| ...this.settings.customBannerMaxWidthField, | ||
| ...this.settings.customBannerHeightField, | ||
| ...this.settings.customFadeField, | ||
| ...this.settings.customBorderRadiusField, | ||
| ...this.settings.customTitleColorField, | ||
| ...this.settings.customBannerShuffleField, | ||
| ...this.settings.customBannerIconField, | ||
| ...this.settings.customBannerIconSizeField, | ||
| ...this.settings.customBannerIconImageSizeMultiplierField, | ||
| ...this.settings.customBannerIconTextVerticalOffsetField, | ||
| ...this.settings.customBannerIconRotateField, | ||
| ...this.settings.customBannerIconImageAlignmentField, | ||
| ...this.settings.customBannerIconXPositionField, | ||
| ...this.settings.customBannerIconOpacityField, | ||
| ...this.settings.customBannerIconColorField, | ||
| ...this.settings.customBannerIconFontWeightField, | ||
| ...this.settings.customBannerIconBackgroundColorField, | ||
| ...this.settings.customBannerIconPaddingXField, | ||
| ...this.settings.customBannerIconPaddingYField, | ||
| ...this.settings.customBannerIconBorderRadiusField, | ||
| ...this.settings.customBannerIconVerticalOffsetField | ||
| ]; | ||
|
|
||
| const hasRelevantChange = relevantFields.some(field => | ||
| frontmatter[field] !== previousFrontmatter?.[field] | ||
| ); |
There was a problem hiding this comment.
There's significant code duplication between this metadataCache.on('resolved', ...) handler and the metadataCache.on('changed', ...) handler (lines 163-230). The logic for defining relevantFields and checking for changes is nearly identical in both places.
To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, I suggest refactoring this duplicated logic into helper methods on the PixelBannerPlugin class.
For example, you could create:
- A method to get the list of relevant fields:
getRelevantBannerFields() { return [ ...this.settings.customBannerField, // ... all other fields ]; }
- A method to check for changes in these fields:
hasRelevantBannerFieldChange(frontmatter, previousFrontmatter) { if (!previousFrontmatter) return true; // Or handle as needed const relevantFields = this.getRelevantBannerFields(); return relevantFields.some(field => frontmatter[field] !== previousFrontmatter[field]); }
Then, both event handlers can call these helper methods, making the code cleaner and easier to maintain.
v3.6.18 - 2026-03-08
🐛 Fixed