angular - Is there any good reason not to partially apply a non-store value into an ngrx/redux selector? -


i using @ngrx/store state management. have service allows various plugins register themselves. service provides selector aggregate generic information each of plugins. so, selector gets replaced new selector every time new plugin gets registered:

public register(plugin: plugin<any>) {     this.store.dispatch(new registeraction(plugin.initialstate));     this.logger.debug("registering plugin %s", plugin.id);     this.pluginregistry[plugin.id] = plugin;      if (plugin.getcontentwithviewerdata) {         this.logger.debug("registering getcontentwithviewerdata plugin %s", plugin.id);         this.getallcontent = createselector(this.getallcontent, plugin.getcontentwithviewerdata,             (allcontent, plugincontent) => {                 return {                     ...allcontent,                     ...pluginidtoplugincontentwithviewerdata(plugin, plugincontent),                 };             });     } }  public getallcontent: (state: eventanalyzerstate) => {[pluginid: string]: plugincontentwithviewerdata} =     (state) => ({}[0]) 

as can see, partially apply plugin object argument of register function selector create getallcontent. there wrong approach? reason shouldnt so? could, instead, have getallcontent return map of selectors instead, seems more friendly consumers. advice here appreciated.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -