Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Add State Management to palette #21507 #1856

Merged
merged 5 commits into from
Feb 1, 2022

Conversation

alfredo-dotcms
Copy link
Contributor

Proposed Changes

we need to add State Management to our Content Reuse Palette

Checklist

  • Tests
  • Translations
  • Security Implications Contemplated (add notes if applicable)

Additional Info

** any additional useful context or info **

Screenshots

Original Updated
** original screenshot ** ** updated screenshot **

@CLAassistant
Copy link

CLAassistant commented Jan 25, 2022

CLA assistant check
All committers have signed the CLA.

rjvelazco
rjvelazco previously approved these changes Jan 25, 2022
return { ...state, filter: data };
});

readonly languageId = this.updater((state: DotPaletteState, data: string) => {
Copy link
Contributor

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) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set...

@alfredo-dotcms alfredo-dotcms force-pushed the issue-21507-Dot-Palette-add-state-management branch from 5ce0c10 to da3326a Compare January 27, 2022 00:00
Comment on lines 60 to 62
this.store.setViewContentlet(viewContentlet);
this.store.setFilter('');
this.store.loadContentlets(variableName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment on lines 129 to 144
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
})
);
Copy link
Member

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.

Comment on lines 175 to 184
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);
})
);
});
Copy link
Member

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?

@nollymar nollymar merged commit efa12bf into master Feb 1, 2022
@delete-merged-branch delete-merged-branch bot deleted the issue-21507-Dot-Palette-add-state-management branch February 1, 2022 19:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants