fix(recipes): render reconnect form for hash-invalid LoRAs in recipe modal

The Reconnect action button was rendered for both deleted and hash-invalid
(Unresolvable Hash) LoRA entries, but the .lora-reconnect-container input
form was only rendered for deleted ones. Clicking Reconnect on a
hash-invalid item silently did nothing because showReconnectInput() could
not find the container. Align the container render condition with the
button condition, and extend the resource-items test to assert the form
opens on click.
This commit is contained in:
Will Miao
2026-08-29 16:49:50 +08:00
parent 2ff98ae089
commit 675421ea84
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -960,7 +960,7 @@ class RecipeModal {
${lora.baseModel ? `<div class="base-model">${lora.baseModel}</div>` : ''} ${lora.baseModel ? `<div class="base-model">${lora.baseModel}</div>` : ''}
</div> </div>
${actionsRow} ${actionsRow}
${isDeleted ? ` ${isDeleted || lora.hashInvalid ? `
<div class="lora-reconnect-container" data-lora-index="${loraIndex}"> <div class="lora-reconnect-container" data-lora-index="${loraIndex}">
<div class="reconnect-instructions"> <div class="reconnect-instructions">
<p>Enter LoRA Syntax or Name to Reconnect:</p> <p>Enter LoRA Syntax or Name to Reconnect:</p>
@@ -342,7 +342,13 @@ describe('RecipeModal resource item interactions', () => {
expect(badge.textContent).toContain('Unresolvable Hash'); expect(badge.textContent).toContain('Unresolvable Hash');
expect(invalidItem.querySelector('.lora-download')).toBeNull(); expect(invalidItem.querySelector('.lora-download')).toBeNull();
expect(invalidItem.querySelector('.lora-reconnect')).not.toBeNull(); const reconnectButton = invalidItem.querySelector('.lora-reconnect');
expect(reconnectButton).not.toBeNull();
reconnectButton.click();
const container = invalidItem.querySelector('.lora-reconnect-container');
expect(container).not.toBeNull();
expect(container.classList.contains('active')).toBe(true);
}); });
it('marks the entry hash-invalid when hash resolution returns Model not found', async () => { it('marks the entry hash-invalid when hash resolution returns Model not found', async () => {