Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞[BUG]: Form actions calling every time, when jumping to previos or other actions #1745

Closed
thenaim opened this issue May 5, 2021 · 6 comments

Comments

@thenaim
Copy link

thenaim commented May 5, 2021

Affected Package

@ngxs/form-plugin

Is this a regression?

No

Description

Can you confirm that this is how it should work or I have a bug in my code?

html

  <ion-toolbar [formGroup]="activeRegion" ngxsForm="countries.activeRegion">
    <ion-segment scrollable formControlName="region">
      <ion-segment-button *ngFor="let region of regions$ | async" [value]="region">
        <ion-label>{{region}}</ion-label>
      </ion-segment-button>
    </ion-segment>
  </ion-toolbar>

ts

export const initialState: CountriesStateModel = {
  activeRegion: {
    model: {
      region: 'Africa',
    },
    dirty: false,
    status: '',
    errors: {},
  },
};

@State<CountriesStateModel>({
  name: 'countries',
  defaults: initialState,
})
@Injectable()
export class CountriesState {}

example stackblitz

form.plugin.issue.mp4
@splincode
Copy link
Member

@markwhitfeld @arturovt what do you think, this is correct behaviour?

@markwhitfeld
Copy link
Member

@thenaim Thank you for the very thorough reproduction. I think that this is a strange interaction between the forms and devtools plugin. In theory, when the state has been updated then the form should sync with the state and the form update actions should not fire off. If the form is updated directly then those actions should fire off (as you would see when changing the tab).
This may potentially be a bug related to the devtools plugin or perhaps about the interaction between the two.

@thenaim
Copy link
Author

thenaim commented May 6, 2021

@markwhitfeld Thank you for your reply. It is very inconvenient, or rather impossible, when you want to reproduce the entire state in the application.

@irowbin
Copy link

irowbin commented May 10, 2021

Unrelated comment deleted and moved by the moderator to a separate issue: #1844 (comment)

@irowbin
Copy link

irowbin commented May 11, 2021

Unrelated comment deleted and moved by the moderator to a separate issue: #1844 (comment)

@arturovt
Copy link
Member

arturovt commented Nov 7, 2022

Regarding this specific issue, I can't find any bug within the form plugin that might be causing this behavior. The plugin reacts to form events and dispatches actions; there's nothing more supernatural. Closing as not an issue (at least in the plugin).

@arturovt arturovt closed this as completed Nov 7, 2022
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

No branches or pull requests

5 participants