Skip to content

feat: add reactive helper on#671

Draft
JeanMeche wants to merge 1 commit intongxtension:mainfrom
JeanMeche:reactive-on
Draft

feat: add reactive helper on#671
JeanMeche wants to merge 1 commit intongxtension:mainfrom
JeanMeche:reactive-on

Conversation

@JeanMeche
Copy link
Contributor

An alternative to explicitEffect for explicit dependencies in an effect

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 introduces a new reactive helper, on, designed to enhance how effects are managed in Angular applications. It provides a more explicit and controlled mechanism for reacting to changes in signals, allowing developers to define specific dependencies and access historical values, thereby offering a powerful alternative to existing effect management patterns. This addition aims to improve the predictability and maintainability of reactive logic within Angular applications.

Highlights

  • New Reactive Helper on: Introduced a new on reactive helper for Angular effects, providing an alternative to explicitEffect for managing explicit dependencies.
  • Explicit Dependency Tracking: The on helper allows developers to explicitly define dependencies for an effect, supporting single signals, arrays of signals, or objects containing signals.
  • Access to Previous Values: The effect callback function now receives both the current and previous input values, enabling more sophisticated state management and change detection logic.
  • New Library Entry Point: A new secondary entry point ngxtension/reactive-on has been added to house this new functionality.
Changelog
  • libs/ngxtension/reactive-on/README.md
    • Added a README file for the new reactive-on secondary entry point.
  • libs/ngxtension/reactive-on/ng-package.json
    • Added Angular package configuration for the reactive-on library.
  • libs/ngxtension/reactive-on/project.json
    • Added Nx project configuration for the reactive-on library.
  • libs/ngxtension/reactive-on/src/index.ts
    • Exported the on helper from its source file.
  • libs/ngxtension/reactive-on/src/on.spec.ts
    • Added comprehensive unit tests for the on helper, covering various dependency types and value tracking.
  • libs/ngxtension/reactive-on/src/on.ts
    • Implemented the core on reactive helper, including type overloads and logic for handling different dependency structures and previous values.
  • tsconfig.base.json
    • Updated the TypeScript path mappings to include the new ngxtension/reactive-on library.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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.

@nx-cloud
Copy link

nx-cloud bot commented Feb 27, 2026

View your CI Pipeline Execution ↗ for commit 7573168

Command Status Duration Result
nx affected --target=build --parallel=3 --exclu... ✅ Succeeded 1s View ↗
nx affected --target=test --parallel=3 --exclud... ✅ Succeeded 32s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 38s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-28 00:12:57 UTC

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 introduces a new reactive helper on which provides an alternative to explicitEffect for managing explicit dependencies in Angular effects. The implementation correctly handles single, array, and object-based signal dependencies, ensuring that effects only re-run when these explicit dependencies change, thanks to the appropriate use of untracked. The accompanying tests are comprehensive, covering various dependency types and the prevInput functionality, demonstrating the helper's intended behavior and robustness. The project setup and documentation are also correctly configured for the new library.

An alternative to `explicitEffect` for explicit dependencies in an effect
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.

1 participant