Skip to content

Commit 6507e77

Browse files
authored
fix(registry-discover): Fixed issue with filters for search section (#482)
1 parent 8f38b95 commit 6507e77

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

src/app/features/moderation/pages/registries-moderation/registries-moderation.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ClearCurrentProvider } from '@core/store/provider';
1313
import { SelectComponent, SubHeaderComponent } from '@osf/shared/components';
1414
import { ResourceType } from '@osf/shared/enums';
1515
import { IS_MEDIUM, Primitive } from '@osf/shared/helpers';
16-
import { GetRegistryProviderBrand } from '@osf/shared/stores/registration-provider';
16+
import { GetRegistryProvider } from '@osf/shared/stores/registration-provider';
1717

1818
import { REGISTRY_MODERATION_TABS } from '../../constants';
1919
import { RegistryModerationTab } from '../../enums';
@@ -44,7 +44,7 @@ export class RegistriesModerationComponent implements OnInit, OnDestroy {
4444
readonly isMedium = toSignal(inject(IS_MEDIUM));
4545

4646
actions = createDispatchMap({
47-
getProvider: GetRegistryProviderBrand,
47+
getProvider: GetRegistryProvider,
4848
clearCurrentProvider: ClearCurrentProvider,
4949
});
5050

src/app/features/registries/pages/registries-landing/registries-landing.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import {
1717
SubHeaderComponent,
1818
} from '@osf/shared/components';
1919
import { ResourceType } from '@osf/shared/enums';
20-
import { GetRegistryProviderBrand, RegistrationProviderSelectors } from '@osf/shared/stores/registration-provider';
20+
import {
21+
ClearRegistryProvider,
22+
GetRegistryProvider,
23+
RegistrationProviderSelectors,
24+
} from '@osf/shared/stores/registration-provider';
2125

2226
import { RegistryServicesComponent } from '../../components';
2327
import { GetRegistries, RegistriesSelectors } from '../../store';
@@ -43,8 +47,9 @@ export class RegistriesLandingComponent implements OnInit, OnDestroy {
4347

4448
private actions = createDispatchMap({
4549
getRegistries: GetRegistries,
46-
getProvider: GetRegistryProviderBrand,
50+
getProvider: GetRegistryProvider,
4751
clearCurrentProvider: ClearCurrentProvider,
52+
clearRegistryProvider: ClearRegistryProvider,
4853
});
4954

5055
provider = select(RegistrationProviderSelectors.getBrandedProvider);
@@ -62,6 +67,7 @@ export class RegistriesLandingComponent implements OnInit, OnDestroy {
6267

6368
ngOnDestroy(): void {
6469
this.actions.clearCurrentProvider();
70+
this.actions.clearRegistryProvider();
6571
}
6672

6773
redirectToSearchPageWithValue(): void {

src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { ClearCurrentProvider } from '@core/store/provider';
1010
import { GlobalSearchComponent } from '@osf/shared/components';
1111
import { ResourceType } from '@osf/shared/enums';
1212
import { SetDefaultFilterValue, SetResourceType } from '@osf/shared/stores/global-search';
13-
import { GetRegistryProviderBrand, RegistrationProviderSelectors } from '@osf/shared/stores/registration-provider';
13+
import {
14+
ClearRegistryProvider,
15+
GetRegistryProvider,
16+
RegistrationProviderSelectors,
17+
} from '@osf/shared/stores/registration-provider';
1418

1519
import { RegistryProviderHeroComponent } from '../../components/registry-provider-hero/registry-provider-hero.component';
1620

@@ -26,10 +30,11 @@ export class RegistriesProviderSearchComponent implements OnInit, OnDestroy {
2630
private route = inject(ActivatedRoute);
2731

2832
private actions = createDispatchMap({
29-
getProvider: GetRegistryProviderBrand,
33+
getProvider: GetRegistryProvider,
3034
setDefaultFilterValue: SetDefaultFilterValue,
3135
setResourceType: SetResourceType,
3236
clearCurrentProvider: ClearCurrentProvider,
37+
clearRegistryProvider: ClearRegistryProvider,
3338
});
3439

3540
provider = select(RegistrationProviderSelectors.getBrandedProvider);
@@ -51,5 +56,6 @@ export class RegistriesProviderSearchComponent implements OnInit, OnDestroy {
5156

5257
ngOnDestroy(): void {
5358
this.actions.clearCurrentProvider();
59+
this.actions.clearRegistryProvider();
5460
}
5561
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
const stateName = '[Registry Provider Search]';
22

3-
export class GetRegistryProviderBrand {
4-
static readonly type = `${stateName} Get Registry Provider Brand`;
3+
export class GetRegistryProvider {
4+
static readonly type = `${stateName} Get Registry Provider`;
55

66
constructor(public providerName: string) {}
77
}
8+
9+
export class ClearRegistryProvider {
10+
static readonly type = `${stateName} Clear Registry Provider`;
11+
}

src/app/shared/stores/registration-provider/registration-provider.state.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { handleSectionError } from '@shared/helpers';
1111

1212
import { RegistrationProviderService } from '../../services';
1313

14-
import { GetRegistryProviderBrand } from './registration-provider.actions';
14+
import { ClearRegistryProvider, GetRegistryProvider } from './registration-provider.actions';
1515
import {
1616
RegistrationProviderStateModel as RegistrationProviderStateModel,
1717
REGISTRIES_PROVIDER_SEARCH_STATE_DEFAULTS,
@@ -25,8 +25,8 @@ import {
2525
export class RegistrationProviderState {
2626
private registrationProvidersService = inject(RegistrationProviderService);
2727

28-
@Action(GetRegistryProviderBrand)
29-
getProviderBrand(ctx: StateContext<RegistrationProviderStateModel>, action: GetRegistryProviderBrand) {
28+
@Action(GetRegistryProvider)
29+
getRegistryProvider(ctx: StateContext<RegistrationProviderStateModel>, action: GetRegistryProvider) {
3030
const state = ctx.getState();
3131

3232
const currentProvider = state.currentBrandedProvider.data;
@@ -75,4 +75,9 @@ export class RegistrationProviderState {
7575
catchError((error) => handleSectionError(ctx, 'currentBrandedProvider', error))
7676
);
7777
}
78+
79+
@Action(ClearRegistryProvider)
80+
clearRegistryProvider(ctx: StateContext<RegistrationProviderStateModel>) {
81+
ctx.setState(patch({ ...REGISTRIES_PROVIDER_SEARCH_STATE_DEFAULTS }));
82+
}
7883
}

0 commit comments

Comments
 (0)