Skip to content

Commit

Permalink
implementation(fix): #29564 blinking effect during category loading (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoreras authored Aug 15, 2024
1 parent d9fcd27 commit 936a75c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
</div>
}
</div>
} @else {
} @else if (!$isInitialState) {
<dot-empty-container [configuration]="$emptyState()" [hideContactUsLink]="true" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export class DotCategoryFieldCategoryListComponent {
*/
$isLoading = input<boolean>(true, { alias: 'isLoading' });

/**
* Represents a variable indicating if the component is in initial state.
*/
$isInitialState = input<boolean>(true, { alias: 'isInitialState' });

/**
* Represents the breadcrumbs to display
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@
</div>
<div class="flex-grow-1 category-field__categories">
@if (store.mode() === 'list') {
@if (store.isListLoaded()) {
<dot-category-field-category-list
@fadeAnimation
(itemChecked)="store.updateSelected($event.selected, $event.item)"
(rowClicked)="store.getCategories($event)"
[categories]="store.categoryList()"
[isLoading]="store.isListLoading()"
[selected]="store.selectedCategoriesValues()"
[breadcrumbs]="store.breadcrumbMenu()" />
}
<dot-category-field-category-list
@fadeAnimation
(itemChecked)="store.updateSelected($event.selected, $event.item)"
(rowClicked)="store.getCategories($event)"
[categories]="store.categoryList()"
[isLoading]="store.isListLoading()"
[isInitialState]="store.isInitSate()"
[selected]="store.selectedCategoriesValues()"
[breadcrumbs]="store.breadcrumbMenu()" />
} @else {
<dot-category-field-search-list
@fadeAnimation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('CategoryFieldStore', () => {
it('should initialize with default state', () => {
expect(store.categories()).toEqual(EMPTY_ARRAY);
expect(store.keyParentPath()).toEqual(EMPTY_ARRAY);
expect(store.state()).toEqual(ComponentStatus.IDLE);
expect(store.state()).toEqual(ComponentStatus.INIT);
expect(store.selected()).toEqual(EMPTY_ARRAY);
expect(store.mode()).toEqual('list');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const initialState: CategoryFieldState = {
selected: [],
categories: [],
keyParentPath: [],
state: ComponentStatus.IDLE,
state: ComponentStatus.INIT,
mode: 'list',
filter: '',
searchCategories: []
Expand Down Expand Up @@ -101,7 +101,7 @@ export const CategoryFieldStore = signalStore(
/**
* Determines if the store state is currently loaded.
*/
isListLoaded: computed(() => store.state() === ComponentStatus.LOADED),
isInitSate: computed(() => store.state() === ComponentStatus.INIT),
/**
* Determines if the search mode is currently loading.
*/
Expand Down

0 comments on commit 936a75c

Please sign in to comment.