Make data undefined on first load in useRecommendedChannels.

This commit is contained in:
Gan Eng Chin 2023-01-27 21:38:38 +08:00
parent 316aad8b2e
commit 49032b98db
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
1 changed files with 5 additions and 7 deletions

View File

@ -16,7 +16,7 @@ import {
type UseRecommendedChannels = {
loading: boolean;
data: Array< RecommendedChannel >;
data?: Array< RecommendedChannel >;
};
export const useRecommendedChannels = (): UseRecommendedChannels => {
@ -33,13 +33,11 @@ export const useRecommendedChannels = (): UseRecommendedChannels => {
* Recommended channels that are not in "active" state,
* i.e. channels that are not installed or not activated yet.
*/
const nonActiveRecommendedChannels = differenceWith(
data,
activePlugins,
( a, b ) => {
const nonActiveRecommendedChannels =
data &&
differenceWith( data, activePlugins, ( a, b ) => {
return a.product === b;
}
);
} );
return {
loading: ! hasFinishedResolution( 'getRecommendedChannels' ),