Skip to content

Fix badge display on initial page load for SPA navigation - #23

Merged
kubrickcode merged 1 commit into
mainfrom
develop/shlee/18
Oct 8, 2025
Merged

Fix badge display on initial page load for SPA navigation#23
kubrickcode merged 1 commit into
mainfrom
develop/shlee/18

Conversation

@kubrickcode

Copy link
Copy Markdown
Owner
  • Expand content script to load on all GitHub repository pages
  • Add debouncing (500ms) to prevent infinite MutationObserver loops
  • Implement processing flag to prevent concurrent API calls
  • Add turbo:load and pjax:end event listeners for SPA routing
  • Wait for DOMContentLoaded when page is still loading

fix #18

@vercel

vercel Bot commented Oct 8, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
github-project-status-viewer Ready Ready Preview Comment Oct 8, 2025 0:01am
github-project-status-viewer-p4ii Ready Ready Preview Comment Oct 8, 2025 0:01am

@kubrickcode
kubrickcode marked this pull request as ready for review October 8, 2025 09:05
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

Thank you for this contribution. The changes to handle SPA navigation and prevent race conditions are a great improvement. I've identified a critical issue related to the initialization of the MutationObserver and a few areas where the code can be made more maintainable by adhering to the repository's style guide.

Specifically, my review focuses on:

  • Correctness: Ensuring the MutationObserver is correctly initialized after SPA navigations.
  • Maintainability: Adhering to style guide rules regarding code duplication (rule #15), magic numbers (rule #10), and code conciseness (rule #4).

Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

Thank you for this contribution. The changes to handle SPA navigation and prevent race conditions are a great improvement. I've identified a critical resource leak with the MutationObserver and a high-risk implementation detail regarding page load timing. Addressing these will significantly improve the extension's robustness and performance.

My review is based on the repository's style guide, focusing on writing clean, bug-free, and maintainable code (Repo Style Guide, Lines 4, 13, 15).

Comment thread extension/src/content.ts Outdated
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request does a great job of improving the extension's robustness, especially for SPA navigation on GitHub. The changes align well with the repository's style guide, particularly regarding the use of constants for magic values (Rule #10) and handling complex asynchronous UI updates. I've identified a couple of issues related to resource management in the new SPA handling logic that could lead to memory leaks and performance degradation over time. My comments below provide details and suggestions for fixing them.

Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

I've reviewed your pull request. The changes look solid and effectively address the issue of badge display on SPA navigations. The use of debouncing, a processing flag, and SPA event listeners are all great additions.

I have a couple of suggestions, mostly related to improving code clarity and maintainability by reducing duplication and refining logic flow. These are based on the repository's style guide, particularly rules about conciseness (#4), avoiding duplication (#15), and writing clean, maintainable code (#13).

Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

I've reviewed your pull request and I'm impressed with the improvements to handle SPA navigation. The use of debouncing, a processing flag, and event listeners for turbo:load and pjax:end are all great additions. I have a few suggestions to further improve the correctness and maintainability of the code. My feedback is focused on ensuring the MutationObserver is managed correctly across SPA navigations and adhering to the project's coding style for variable declarations. Please see my detailed comments below.

Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts Outdated
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This is a great pull request that significantly improves the robustness of the extension, especially with handling SPA navigation on GitHub. The use of debouncing, a processing flag, and polling for elements are all excellent additions.

I've found a couple of areas for improvement:

  • Code Style: There's a minor violation of the repository's style guide regarding the alphabetical sorting of constants.
  • Robustness: There's a potential edge case with a lingering timer after SPA navigation that could be addressed for improved stability.

I've left specific suggestions on the relevant lines of code. Keep up the great work!

Comment thread extension/src/content.ts
Comment thread extension/src/content.ts
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

Overall, the changes in this pull request are well-implemented and effectively address the issue of badge display on SPA navigation. The use of debouncing, a processing flag, and event listeners for turbo:load and pjax:end demonstrates a solid understanding of the complexities of developing a content script for a modern web application like GitHub.

The code adheres well to the provided style guide. My review includes a couple of suggestions for minor refactoring to further improve modularity and code reuse, in line with Rule #7 (Separation of concerns) and Rule #15 (Code reuse and modularization) from the repository's style guide. These are not critical but would enhance the long-term maintainability of the code.

Comment thread extension/src/content.ts Outdated
Comment thread extension/src/content.ts
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This is a great pull request that significantly improves the extension's robustness, especially with the handling of Single-Page Application (SPA) navigation on GitHub. The code is well-structured, and the logic for debouncing, preventing concurrent processing, and polling for DOM elements is solid.

I've reviewed your changes against the repository's style guide and found that the code adheres to it well. Specifically, I noticed and appreciated:

  • Use of Constants: Magic numbers and strings have been correctly extracted into constants (Style Guide, line 10).
  • Separation of Concerns: The new functions like cleanupPollingTimers, cleanupObserver, and handleSPARouting create a clean separation of logic (Style Guide, line 7).
  • TypeScript Best Practices: The code correctly uses type over interface and arrow functions, as per the guidelines (Style Guide, lines 22-23).

I have one high-severity comment regarding a potential resource leak during SPA navigation. Otherwise, the changes are excellent.

Comment thread extension/src/content.ts Outdated
  - Expand content script to load on all GitHub repository pages
  - Add debouncing (500ms) to prevent infinite MutationObserver loops
  - Implement processing flag to prevent concurrent API calls
  - Add turbo:load and pjax:end event listeners for SPA routing
  - Wait for DOMContentLoaded when page is still loading

fix #18
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the issue of badge display on SPA navigation by expanding the content script's scope and implementing robust handling for both initial page loads and dynamic content changes via turbo:load and pjax:end events. The introduction of debouncing for the MutationObserver and a processing flag for API calls are excellent improvements for performance and stability.

The code adheres well to the provided repository style guide, particularly in its use of constants, arrow functions, and early returns. My review includes one suggestion aimed at further improving long-term maintainability by separating concerns, in line with the style guide's principles.

Comment thread extension/src/content.ts
@kubrickcode
kubrickcode merged commit 2c09219 into main Oct 8, 2025
4 checks passed
@kubrickcode
kubrickcode deleted the develop/shlee/18 branch October 8, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The issue is that the status is displayed only when refreshing the issue page.

1 participant