Skip to content

Conversation

@MichaelDoyle
Copy link
Owner

Refactors the click handling, and adds built in functionality to follow http(s) links. Users will be able to extend with their own click handlers.

@MichaelDoyle MichaelDoyle self-assigned this Oct 17, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @MichaelDoyle, 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 significantly enhances the interactivity of the ngx-json-treeview component by overhauling its click handling mechanism. The change introduces a new, more modular system that allows for multiple custom click handlers to be registered, replacing the previous single-function approach. This not only provides built-in functionality for following web links but also opens up extensive possibilities for developers to implement their own value-based interactions.

Highlights

  • Refactored Click Handling: The previous isClickableValue input and onValueClick output have been replaced with a more flexible valueClickHandlers input, which accepts an array of ValueClickHandler objects.
  • Built-in Link Following: A new followLinkHandler is introduced, enabling the ngx-json-treeview component to automatically detect and open HTTP/HTTPS links found in string values in a new tab.
  • Extensible Handler System: Users can now define and provide their own custom ValueClickHandler implementations, allowing for highly customizable click behaviors beyond just following links.
  • Breaking Change: This update is a breaking change as the API for handling clickable values has been significantly altered, requiring updates to existing implementations that used isClickableValue and onValueClick.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 introduces a significant and beneficial refactoring of the click handling mechanism, moving from a single callback to a more extensible system of value click handlers. This is a well-executed breaking change that also adds a useful built-in handler for following hyperlinks. My review includes a critical security fix for the new link handler to prevent tabnabbing, along with suggestions to improve performance and code clarity in the component's logic for handling these new click handlers.

@MichaelDoyle
Copy link
Owner Author

/gemini review

Copy link

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

Choose a reason for hiding this comment

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

Code Review

The pull request refactors the click handling in the ngx-json-treeview component to allow users to extend it with their own click handlers. It introduces a new ValueClickHandler interface and a followLinkHandler to handle HTTP(S) links. The changes replace the isClickableValue input with valueClickHandlers, providing a more flexible way to manage click actions. The demo app component is updated to use the new handler approach.

@MichaelDoyle
Copy link
Owner Author

/gemini review

Copy link

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

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 introduces a significant and valuable refactoring of the click handling mechanism, making it more extensible with ValueClickHandler and adding a useful built-in handler for following links. The overall direction is excellent. However, I've identified two high-severity issues in the implementation within NgxJsonTreeviewComponent. One concerns the use of a shared array instance for a default input value, which can lead to state-related bugs across component instances. The other is a lack of robust error handling for user-provided handlers, which could cause application instability. I have provided detailed comments and code suggestions to address these points.

@MichaelDoyle
Copy link
Owner Author

/gemini review

Copy link

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

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 introduces a significant and beneficial refactoring of the click handling mechanism, making it more modular and extensible through valueClickHandlers. The addition of a built-in handler for following HTTP/HTTPS links is a great feature. The implementation is robust, with good error handling for custom handlers. I have one suggestion to further improve the code by consolidating some duplicated logic into a helper method, which will enhance maintainability.

@MichaelDoyle
Copy link
Owner Author

/gemini review

Copy link

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

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 introduces a significant and beneficial refactoring of the click handling mechanism, moving from a single callback to a more extensible system of value click handlers. The addition of a built-in handler for following HTTP/HTTPS links is a great feature. The code is well-structured, but I have a few suggestions to improve robustness, performance, and code clarity in the new implementation. My comments focus on simplifying the URL validation, avoiding redundant computations in click handling logic, and ensuring handlers are not executed when they are disabled.

@MichaelDoyle MichaelDoyle changed the title BREAKING CHANGE: Follow links Follow links Oct 19, 2025
@MichaelDoyle
Copy link
Owner Author

/gemini review

Copy link

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

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 refactors the click handling mechanism to be more extensible by introducing ValueClickHandler. The new approach is well-designed, allowing users to provide custom click behaviors easily. The addition of a built-in followLinkHandler for HTTP/HTTPS links is a great feature. The implementation also thoughtfully maintains backward compatibility with the old API. My feedback focuses on improving the debuggability for developers using custom handlers by logging errors instead of silently ignoring them.

@MichaelDoyle MichaelDoyle merged commit 98b0ca8 into main Oct 19, 2025
1 check passed
@MichaelDoyle MichaelDoyle deleted the follow-links branch October 19, 2025 04:50
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.

2 participants