fix(inventory): enable Clear RFID Tag for a tray-UUID-only spool (issue #3109)

The button gated on tag_uid alone. A spool linked by its 32-character
Bambu tray UUID carries none -- Bambuddy splits a stored tag by length,
so a 32-char value becomes tray_uuid and tag_uid stays empty. In
Spoolman mode that is every Bambu Lab spool synced from the AMS; on the
reporter's instance, 35 of 39 tagged spools, none of which could have
its tag cleared from the dialog. The documented workaround was to edit
extra.tag in Spoolman's own interface.

Everything around the button already treated those spools as tagged.
The Tag ID column renders whichever identifier is present, and the
payload the button sends nulls both fields -- which both inventory
modes honour: the built-in PATCH applies them through exclude_unset,
and the Spoolman route keys its tag-removal branch off either field
being explicitly null.

Either identifier now enables it, and clearing still removes both.
This commit is contained in:
maziggy
2026-09-20 11:21:19 +02:00
parent 905bda4f3f
commit 885c4156ae
5 changed files with 123 additions and 3 deletions
+8 -1
View File
@@ -1128,10 +1128,17 @@ export function SpoolFormModal({
<div className="flex gap-2 p-4 border-t border-bambu-dark-tertiary flex-shrink-0">
{isEditing && (
<div className="flex gap-2 mr-auto">
{/* Either identifier counts as "tagged". A Bambu Lab spool is
linked by its 32-char tray UUID and carries no tag_uid at all
-- in Spoolman mode that is every Bambu spool, because
_map_spoolman_spool splits extra.tag by length -- so gating on
tag_uid alone left this permanently greyed out for them, while
the Tag ID column beside it showed the UUID and the payload
below already cleared both fields (#3109). */}
<Button
variant="secondary"
onClick={() => deleteTagMutation.mutate()}
disabled={isPending || !spool?.tag_uid}
disabled={isPending || !(spool?.tag_uid || spool?.tray_uuid)}
>
<Tag className="w-4 h-4" />
{t('inventory.clearRfid', 'Clear RFID Tag')}