Use update entities for showing updates on configuration panel#12100
Use update entities for showing updates on configuration panel#12100
Conversation
|
|
||
| protected render(): TemplateResult { | ||
| const canInstallUpdates = updateEntities(this.hass.states).filter( | ||
| (entity) => updateCanInstall(entity) |
There was a problem hiding this comment.
Why not do this filtering inside the memoized call ?
Should that filter also sort it by state name ?
There was a problem hiding this comment.
It's better to hit a memoized call here and do an extra filter in the _handleAction, because when handling an action there is nothing else going on. We want to do as little as possible when rendering.
| import { showToast } from "../../../util/toast"; | ||
| import { documentationUrl } from "../../../util/documentation-url"; | ||
|
|
||
| const updateEntities = memoizeOne( |
There was a problem hiding this comment.
Put the memoized functions on the class instances such that running this class doesn't change any module variables.
There was a problem hiding this comment.
We might not run the dashboard twice, but people might copy the pattern from here.
There was a problem hiding this comment.
Also it's slightly faster when the dashboard is not shown, as memoizeOne is only executed when class is instantiated if set as instance var.
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
…ontend into config_update_entities
Breaking change
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: