mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
🆙 Fix the catalog search in some cases it will give a black screen
This commit is contained in:
@@ -18,16 +18,18 @@ export const CatalogGridOfferView: FC<CatalogGridOfferViewProps> = props =>
|
||||
const { requestOfferToMover = null } = useCatalog();
|
||||
const { isVisible = false } = useInventoryFurni();
|
||||
const { isFavoriteOffer, toggleFavoriteOffer } = useCatalogFavorites();
|
||||
const isFav = isFavoriteOffer(offer.offerId);
|
||||
const isFav = offer ? isFavoriteOffer(offer.offerId) : false;
|
||||
|
||||
const iconUrl = useMemo(() =>
|
||||
{
|
||||
if(!offer) return null;
|
||||
|
||||
if(offer.pricingModel === Offer.PRICING_MODEL_BUNDLE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return offer.product.getIconUrl(offer);
|
||||
return offer.product?.getIconUrl(offer) ?? null;
|
||||
}, [ offer ]);
|
||||
|
||||
const onMouseEvent = (event: MouseEvent) =>
|
||||
@@ -49,6 +51,8 @@ export const CatalogGridOfferView: FC<CatalogGridOfferViewProps> = props =>
|
||||
}
|
||||
};
|
||||
|
||||
if(!offer) return null;
|
||||
|
||||
const product = offer.product;
|
||||
|
||||
if(!product) return null;
|
||||
|
||||
@@ -22,6 +22,8 @@ export const CatalogSearchView: FC<{}> = () =>
|
||||
|
||||
const timeout = setTimeout(() =>
|
||||
{
|
||||
if(!offersToNodes || !rootNode) return;
|
||||
|
||||
const furnitureDatas = GetSessionDataManager().getAllFurnitureData();
|
||||
|
||||
if(!furnitureDatas || !furnitureDatas.length) return;
|
||||
@@ -31,11 +33,13 @@ export const CatalogSearchView: FC<{}> = () =>
|
||||
|
||||
for(const furniture of furnitureDatas)
|
||||
{
|
||||
if(!furniture) continue;
|
||||
|
||||
if((currentType === CatalogType.BUILDER) && !furniture.availableForBuildersClub) continue;
|
||||
|
||||
if((currentType === CatalogType.NORMAL) && furniture.excludeDynamic) continue;
|
||||
|
||||
const searchValues = [ furniture.className, furniture.name, furniture.description ].join(' ').replace(/ /gi, '').toLowerCase();
|
||||
const searchValues = [ furniture.className || '', furniture.name || '', furniture.description || '' ].join(' ').replace(/ /gi, '').toLowerCase();
|
||||
|
||||
if((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user