Skip to content

Commit

Permalink
fix(list-components): avoid injecting undefined default value since V…
Browse files Browse the repository at this point in the history
…ue does it
  • Loading branch information
joseacabaneros committed Jul 26, 2024
1 parent 6a612ab commit 9697a4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,10 @@
]).nextQueries;
/** Injected query, updated when the related request(s) have succeeded. */
const injectedQuery = inject<Ref<string> | undefined>(QUERY_KEY as string, undefined);
const injectedQuery = inject<Ref<string>>(QUERY_KEY as string);
/** Indicates if there are more available results than the injected. */
const hasMoreItems = inject<Ref<boolean> | undefined>(
HAS_MORE_ITEMS_KEY as string,
undefined
);
const hasMoreItems = inject<Ref<boolean>>(HAS_MORE_ITEMS_KEY as string);
/**
* The grouped next queries based on the given config.
Expand All @@ -93,10 +90,7 @@
);
/** It injects {@link ListItem} provided by an ancestor as injectedListItems. */
const injectedListItems = inject<Ref<ListItem[]> | undefined>(
LIST_ITEMS_KEY as string,
undefined
);
const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string);
/**
* Checks if the next queries are outdated taking into account the injected query.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
const stateItems: ComputedRef<Banner[]> = useState('search', ['banners']).banners;
/** The provided {@link FeatureLocation} for the component. */
const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation | undefined>(
'location',
undefined
);
const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location');
const location = isRef(injectedLocation) ? injectedLocation.value : injectedLocation;
/** Number of columns the grid is being divided into. */
Expand All @@ -60,10 +57,7 @@
});
/** It injects {@link ListItem} provided by an ancestor as injectedListItems. */
const injectedListItems = inject<Ref<ListItem[]> | undefined>(
LIST_ITEMS_KEY as string,
undefined
);
const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string);
/**
* The `stateItems` concatenated with the `injectedListItems` if there are.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
const stateItems: ComputedRef<Promoted[]> = useState('search', ['promoteds']).promoteds;
/** It injects {@link ListItem} provided by an ancestor as injectedListItems. */
const injectedListItems = inject<Ref<ListItem[]> | undefined>(
LIST_ITEMS_KEY as string,
undefined
);
const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string);
/**
* The `stateItems` concatenated with the `injectedListItems` if there are.
Expand Down

0 comments on commit 9697a4a

Please sign in to comment.