@ngrdt/forms 0.0.42 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -644,8 +644,12 @@ function getRdtSelectStore(initialState = rdtSelectInitialState) {
644
644
  }),
645
645
  })), withMethods((store) => ({
646
646
  init(initialValue) {
647
- this.setSelected(initialValue ?? []);
648
- patchState(store, { initialized: true });
647
+ if (initialValue && initialValue.length > 0) {
648
+ this.setSelected(initialValue ?? []);
649
+ }
650
+ else {
651
+ patchState(store, { initialized: true });
652
+ }
649
653
  },
650
654
  fetch() {
651
655
  const datasource = untracked(store.datasource);
@@ -820,10 +824,13 @@ function getRdtSelectStore(initialState = rdtSelectInitialState) {
820
824
  _loadMissingSelected() {
821
825
  const datasource = store.datasource();
822
826
  const reallyMissing = this._setAndGetMissing();
823
- if (!untracked(store.loading) &&
824
- reallyMissing.length > 0 &&
825
- datasource) {
826
- this._fetchMissing(reallyMissing, datasource);
827
+ if (!untracked(store.loading) && datasource) {
828
+ if (reallyMissing.length > 0) {
829
+ this._fetchMissing(reallyMissing, datasource);
830
+ }
831
+ else {
832
+ patchState(store, { initialized: true });
833
+ }
827
834
  }
828
835
  },
829
836
  _cancelFetchMissingIfNeeded() {
@@ -858,6 +865,7 @@ function getRdtSelectStore(initialState = rdtSelectInitialState) {
858
865
  _fetchMissingRequest: null,
859
866
  _missingSelected: newMissing,
860
867
  selectedMap: newSelected,
868
+ initialized: true,
861
869
  });
862
870
  this._loadMissingSelected();
863
871
  });