Skip to content

application freezes and show high CPU usage when forms instantiated from property #531

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

Closed
1 task done
pumano opened this issue Feb 26, 2019 · 7 comments
Closed
1 task done

Comments

@pumano
Copy link
Contributor

pumano commented Feb 26, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.4

Environment

vue: 2.6.7, ant-design-vue: 1.3.5, vue-class-component: 7.0.1, typescript: 3.3.3, vue-property-decorator: 7.3.0

Reproduction link

https://stackblitz.com/edit/typescript-vuejs-form-init

Steps to reproduce

it caused only when we instantiate forms from class component

What is expected?

in examples we see something like:

export default {
  data () {
     return {
       hasErrors,
       form: this.$form.createForm(this),
     };
  }
}

it's same if we use pure class property in vue class component:

export class MyComponent extends Vue {

// data
form = this.$form.createForm(this);

}

but that instantiation just freeze application and you can't enter any value to form.

If we use created() hook it will work properly:

export class MyComponent extends Vue {

// data
form;

created() {
    this.form = this.$form.createForm(this);
}

}

What is actually happening?

this.form = this.$form.createForm(this); not working in vue class component and freeze application with high CPU usage


check stackblitz example for demo

@pumano pumano changed the title application freezes and show high CPU usage when using we create forms application freezes and show high CPU usage when forms instantiated from property Feb 26, 2019
@tangjinzhou
Copy link
Member

ref #392

@pumano
Copy link
Contributor Author

pumano commented Feb 28, 2019

Note: in some examples createForm executed on beforeCreate hook. But looks like it should works with plain property instantiation

@tangjinzhou
Copy link
Member

you can createform before beforecreate.

@bmfs
Copy link

bmfs commented Apr 17, 2020

I've faced the same issue in version 1.5.3.

creating the form either in beforeCreate or data() are the solutions.
Nevertheless, I would expect some kind of error if the instantiation isn't done correctly. Having the browser freeze doesn't seem a good behavior.

My use case was a bit stranger. My form was inside a Modal. The application only froze when I closed the modal.

@Shuunen
Copy link

Shuunen commented Jun 16, 2020

still having this issue with "ant-design-vue": "^1.6.2", 😟

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants