-
Notifications
You must be signed in to change notification settings - Fork 34
Add State Management to palette #21507 #1856
Conversation
return { ...state, filter: data }; | ||
}); | ||
|
||
readonly languageId = this.updater((state: DotPaletteState, data: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateLanguage or setLanguageId
return { ...state, languageId: data }; | ||
}); | ||
|
||
readonly viewContentlet = this.updater((state: DotPaletteState, data: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set...
5ce0c10
to
da3326a
Compare
this.store.setViewContentlet(viewContentlet); | ||
this.store.setFilter(''); | ||
this.store.loadContentlets(variableName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.store.setViewContentlet(viewContentlet); | |
this.store.setFilter(''); | |
this.store.loadContentlets(variableName); | |
this.store.switchView(...); |
And do all the other things internally? We only call all those here.
readonly vm$ = this.select( | ||
this.contentlets$, | ||
this.contentTypes$, | ||
this.filter$, | ||
this.totalRecords$, | ||
this.viewContentlet$, | ||
this.loading$, | ||
(contentlets, contentTypes, filter, totalRecords, viewContentlet, loading) => ({ | ||
contentlets, | ||
contentTypes, | ||
filter, | ||
totalRecords, | ||
viewContentlet, | ||
loading | ||
}) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all the selectors that are not being used and just use the full state object if you want to skip lang id cool, but I would just send it.
readonly switchView = this.effect((variableName$: Observable<string>) => { | ||
return variableName$.pipe( | ||
map((variableName: string) => { | ||
const viewContentlet = variableName ? 'contentlet:in' : 'contentlet:out'; | ||
this.setViewContentlet(viewContentlet); | ||
this.setFilter(''); | ||
this.loadContentlets(variableName); | ||
}) | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is an effect
?
Proposed Changes
we need to add State Management to our Content Reuse Palette
Checklist
Additional Info
** any additional useful context or info **
Screenshots