mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: device purchase guard condition and cache invalidation
- Fix guard: available === false alone now properly gates the unavailability message (was incorrectly AND-ed with !max_device_limit) - Remove dead code block that was unreachable after guard fix - Add device-price cache invalidation after successful purchase
This commit is contained in:
@@ -276,6 +276,7 @@ export default function Subscription() {
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['subscription'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['devices'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['device-price'] });
|
||||
setShowDeviceTopup(false);
|
||||
setDevicesToAdd(1);
|
||||
},
|
||||
@@ -1196,7 +1197,7 @@ export default function Subscription() {
|
||||
</div>
|
||||
|
||||
{/* Check if completely unavailable (no subscription, price not set, etc.) */}
|
||||
{devicePriceData?.available === false && !devicePriceData?.max_device_limit ? (
|
||||
{devicePriceData?.available === false ? (
|
||||
<div className="py-4 text-center text-sm text-dark-400">
|
||||
{devicePriceData.reason ||
|
||||
t('subscription.additionalOptions.devicesUnavailable')}
|
||||
@@ -1245,13 +1246,6 @@ export default function Subscription() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Show reason if can't add requested amount */}
|
||||
{devicePriceData?.available === false && devicePriceData?.reason && (
|
||||
<div className="rounded-lg bg-warning-500/10 p-3 text-center text-sm text-warning-400">
|
||||
{devicePriceData.reason}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Price info - only when available */}
|
||||
{devicePriceData?.available && devicePriceData.price_per_device_label && (
|
||||
<div className="text-center">
|
||||
|
||||
Reference in New Issue
Block a user