mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.34k stars 1.15k forks source link

4.5.9 Material Select causes catastrophic crash during destroy + rebuild #183

Closed kearns-arthur closed 6 years ago

kearns-arthur commented 6 years ago

Expected behavior

Destroying and rebuilding of a material select list correctly.

Actual behavior

Hangs or crashes the browser.

Your working environment and MDB version information

MDB PRO 4.5.9, Windows, any browser

Resources (screenshots, code snippets etc.)

In 4.5.8 this was not an issue. In 4.5.9 there is a new '_onMutationObserverChange' and it is my assumption this new function is the problem.

458 Version 4.5.8 Performance

459 Version 4.5.9 Performance

My script: function getMakesModels(id) { $.ajax({ type: 'GET', url: uri + "/getmakemodels/" + id, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { document.getElementById('idxmodels').options.length = 0; $('#idxmodels').append(); $.each(data, function (i, item) { $('#idxmodels').append(); }); $('.mdb-select').material_select('destroy'); $('.mdb-select').material_select(); }, failure: function (response) { alert(response.d); }, error: function (response) { alert(response.d); } }); }

For every question of technical nature, in order to get the most detailed answer as soon as possible, ask on our dedicated Support Forum

catchmareck commented 6 years ago

Hi, indeed there is a nasty bug in our code. It's caused by MutationObservers which are not disconnected on the Material Select re-render. It has been fixed already and will be available in the nearest release. For now, you just need to get rid of the mentioned method and manually rebuild/re-minify the package. Sorry for inconveniences

vladviolentiy commented 4 years ago

I see like problem in MDB 4.8.4 Screenshot_20191111_153426