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

slow modal performance when typing in formcontrol #429

Open
Belouccio opened this issue Jan 23, 2019 · 1 comment
Open

slow modal performance when typing in formcontrol #429

Belouccio opened this issue Jan 23, 2019 · 1 comment

Comments

@Belouccio
Copy link

Belouccio commented Jan 23, 2019

I have a form with many controls inside my sui-modal. When I type text it works very slow, cause modal classes updates dynamicly on every event on page.

I found this peace of code in modal.js and write console.log to show what's going inside

Object.defineProperty(SuiModal.prototype, "dynamicClasses", {
        get: function () {
            console.log('Changes');
            var classes = {};
            if (this.size) {
                classes[this.size] = true;
            }
            return classes;
        },
        enumerable: true,
        configurable: true
    });

And this line of code in modal.js

SuiModal.decorators = [
       { type: _angular_core.Component, args: [{
            ...
            template: " ... [ngClass]=\"dynamicClasses\"\n   ... "
            ...
       },] },
    ];

So, when I type something, text render works very slow (it looks like computer slows down) , cause dynamicClasses updates, and modal styles starts recalculate, you can see it in screennshots.
http://joxi.ru/bmojMDPCxzVE8r
http://joxi.ru/E2pQGYPU9zR1DA

How can I fix this?

P.S. Thank you for your work 👍 and sorry for my bad English :)

Angular: 5.0.0
ng2-semantic-ui: ^0.9.7

@Belouccio
Copy link
Author

I have change dynamicClasses like this, but I think is not correct way to solve problem. What do you think?

Object.defineProperty(SuiModal.prototype, "dynamicClasses", {
        get: function () {
            return this.size || '';
        },
        enumerable: true,
        configurable: true
    });

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

1 participant