Comments (6)
Thank you for the report.
Right now I'm a bit tight on time.
If you could provide me a jsbin of a scenario like this, I could definitely to take a look.
If you're wondering how to use ES6 classes on jsbin, just copy and paste the component code in a globals Component there. 😄
from ember-cli-selectize.
Here is a JSbin : http://emberjs.jsbin.com/hoqenocira/2/edit?html,js,output
(I had to add the ember-new-computed code)
It detects an infinite/too long loop, so I added // noprotect
in selectionArrayWillChange
.
I could not reproduce the really slow performance I observe in my app, so I might have other problems..
from ember-cli-selectize.
Seems pretty fast as well to me, but that might be because we're using fixtures here. I can also see that selectionArrayDidChange
is running multiple times per route change.
I believe this is related with the selection=model.items.content
part and thus related with #58. We should probably wait until the promise resolves to bind the observer.
Will do further investigation.
from ember-cli-selectize.
Here I test if selection is a promise, and only bind array observers when it is resolved:
http://emberjs.jsbin.com/rogenifopa/1/edit?html,js,console,output
Looks good. selectionArrayDidChange
runs only once. Seems the way to go.
from ember-cli-selectize.
Edit: looks like that was already happening in your jsbin. My mistake.
Bottomline, your JSBin doesn't seem to have anything wrong with it and probably does not reproduce the problem in your app?
from ember-cli-selectize.
One of the main differences with my app is the use of templating (optionFunction
, itemFunction
).
I've done some profiling on my app.
Most of the time is spend in selectize
, method updateOriginalInput
, which keeps the original input up-to-date (which does not matter in ember-selectize).
Adding the following plugin to Selectize helps a lot (from 0.8s to 0.4s) :
Selectize.define('optimised', function(/*options*/) {
// options: plugin-specific options
// this: selectize instance
var self = this;
this.updateOriginalInput = (function() {
var original = self.updateOriginalInput;
return function(opts) {
opts = opts || {};
// constant in Selectize
var TAG_SELECT = 1;
if (self.tagType === TAG_SELECT) {
// copy the final action, bypasses a loop on all items and many HTML operations
if (self.isSetup) {
if (!opts.silent) {
self.trigger('change', self.$input.val());
}
}
} else {
// use the original full method
original.apply(this, arguments);
}
};
})();
});
After this change, most of the time is spent in the methods ObjectWasRemoved
and selectionObjectWasAdded
, and inside them, the time is spent in selectize setCaret
and positionDropdown
when removing the items, and in refreshOptions
when adding items.
from ember-cli-selectize.
Related Issues (20)
- hideSelected and multiple don't work together HOT 1
- v0.5.8 broke the selectize styles HOT 4
- selectize.js:2151 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
- multiple mode bug? HOT 2
- Selectize changing my model property to null
- Best Practice for adding/removing on a REST/API error
- add 'readOnly' to 'generalOptions ' HOT 2
- Move selectize and sifter from Bower to NPM HOT 3
- select-item action should not fire when selection promise resolves. HOT 1
- Using multiple=true with ember-changeset-validations HOT 3
- Add Support for data-dash-attributes
- Can't install due to missing dependency HOT 1
- Label truncates when second word contains letters in the first in multiple mode HOT 1
- Tooltip for list
- 2 selectors in the same template and options visible for both of them at the same time HOT 1
- Fix breaking changes in FastBoot 1.0 HOT 1
- Migration to power select HOT 1
- DEPRECATION HOT 1
- Deprecated calls to sendAction
- ember-cli-selectize triggers a Maximum Call Stack exceeded errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-selectize.