fix(loyalty-admin): existing-program warning crashes when no merchant selected
Some checks failed
Some checks failed
The warning panel was wrapped in x-show, which only toggles display:none — child :href bindings still evaluate, so the 'selectedMerchant.id' access inside the link threw 'TypeError: can't access property "id", selectedMerchant is null' on every reactive update before a merchant was picked. Switch to <template x-if> so the element is removed from the DOM entirely when the condition is false; child bindings then never run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -310,8 +310,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Existing program warning -->
|
||||
<div x-show="selectedMerchant && existingProgramForMerchant(selectedMerchant.id)"
|
||||
class="mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-lg dark:bg-yellow-900/20 dark:border-yellow-800">
|
||||
<template x-if="selectedMerchant && existingProgramForMerchant(selectedMerchant.id)">
|
||||
<div class="mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-lg dark:bg-yellow-900/20 dark:border-yellow-800">
|
||||
<div class="flex items-start">
|
||||
<span x-html="$icon('exclamation-triangle', 'w-5 h-5 text-yellow-500 mr-3 mt-0.5 flex-shrink-0')"></span>
|
||||
<div>
|
||||
@@ -324,6 +324,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="flex justify-end gap-3">
|
||||
|
||||
Reference in New Issue
Block a user