Skip to content

FEATURE: angular effects untracked SkipInitial #56098

Closed as not planned
Closed as not planned

Description

@ScriptType

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

The effect has to do an Initial run to keep track of the used signal, If we have untracked inside of it it would be nice to skip the Initial run.

Proposed solution

constructor() {
  effect(() => {
      const someSignalValue = this.signalStuff()
      untracked(() => {
         this.doSomethingWithValue(someSignalValue)
      },{skipInitial: true});
    });
}

Alternatives considered

constructor() {
let skipInitial = true;
  effect(() => {
      const someSignalValue = this.signalStuff()
      untracked(() => {
         if (skipInitial) {
             skipInitial = false;
             return;
         }
         this.doSomethingWithValue(someSignalValue)
      });
    });
}

Activity

  1. changed the title [-]angular effects untracked SkipInitial[/-] [+]FEATURE: angular effects untracked SkipInitial[/+] on May 27, 2024
  2. pkozlowski-opensource commented on May 27, 2024

    @pkozlowski-opensource
    Member

    would be nice to skip the Initial run

    Could you tell us more about the real-life use-case? Why would the "initial run" be any special?

  3. added this to the needsTriage milestone on May 27, 2024
  4. ScriptType commented on May 29, 2024

    @ScriptType
    Author

    In A Custom Form Component i use signals and effect´s to call onChange. The Problem with the initial run is the component directly becomes pristine === false .

  5. e-oz commented on May 29, 2024

    @e-oz

    I don't get the idea, but curios to see a real example on StackBlitz.

  6. pkozlowski-opensource commented on Jun 17, 2024

    @pkozlowski-opensource
    Member

    Agree with @e-oz - it is hard to understand the real-life use-case here. We really need code example in a stackblitz - otherwise it is not actionable for us.

  7. modified the milestones: needsTriage, Backlog on Jun 17, 2024
  8. pkozlowski-opensource commented on Aug 7, 2024

    @pkozlowski-opensource
    Member

    I'm going to close this one since we didn't get more concrete info besides

    In A Custom Form Component i use signals and effect´s to call onChange. The Problem with the initial run is the component directly becomes pristine === false .

    In this case the effect could skip processing under specific conditions. Again, hard to say more given the available information.

  9. angular-automatic-lock-bot commented on Sep 7, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. locked and limited conversation to collaborators on Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: reactivityWork related to fine-grained reactivity in the core frameworkcross-cutting: signalsneeds reproductionThis issue needs a reproduction in order for the team to investigate furtherneeds: clarificationThis issue needs additional clarification from the reporter before the team can investigate.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo