-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Hi, I'm on riot 2.4.1 and riotcontrol 0.0.3. I'm using webpack to transpile es7.
I'm running into problems with event handlers being fired multiple times after a single event trigger. It seems to be related to my use of multiple stores and riot.observable(this) in the constructor, but I'm not sure how to do it differently. After looking through the other issues, someone suggested using a single broker = riot.observable(); for all stores, but I'm not sure how to get that working.
My handler is definitely added only once, and commenting out the riot.observable(this) in stores reduces the number of times the event is fired.
class AutoCompleteStore {
constructor() {
riot.observable(this);
}
}
let autoCompleteStore = new AutoCompleteStore();
riot.control.addStore(autoCompleteStore);
export default autoCompleteStore;
In my page tag:
let changeResultsHandler = () => {
console.info("changeResultsHandlerFired");
this.update();
}
this.on('mount', () => {
riot.control.on(riot.EVT.changeResults, changeResultsHandler);
riot.control.trigger(riot.EVT.changeResults);
});
this.on('unmount', () => {
riot.control.off(riot.EVT.changeResults, changeResultsHandler);
});
Am I using the correct patterns here?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels