Repository navigation
Description
In the login page editor, hiding the Login Image section can leave Save disabled with no visible reason. isCustomSizeInvalid applies whenever logoSize is 'custom', whatever showLogo is set to. The only message that explains it ("Enter at least one positive value (1–5000).") is rendered inside the Login Image card's content, and that content unmounts when "Show" is unticked. An admin who picks Custom size, leaves the dimensions blank, and then hides the image gets a disabled Save button and nothing on screen that says why. The resource-links check already skips its section when it is hidden (form.showResourceLinks && ...). The logo check does not.
Where
apps/web/src/components/LoginPageEditor/hooks.ts:244-248:
const isCustomSizeInvalid =
form.logoSize === 'custom' &&
((form.customLogoWidth.trim() !== '' && customWidth === null) ||
(form.customLogoHeight.trim() !== '' && customHeight === null) ||
(customWidth === null && customHeight === null));apps/web/src/components/LoginPageEditor/sections/SectionCards.tsx:105: the card content, including the error message at lines 262-270, renders only while the section is shown:
{form.showLogo && (
<Card.Content className="flex flex-col gap-4">Reproduce
- Sign in as an admin and open
/admin/branding/login-pageon an instance with no custom logo size saved. - In "Login Image", set Size to "Custom" and leave Width and Height empty.
- Untick "Show" on the Login Image card.
Actual: Save stays disabled, and no error is visible anywhere on the page.
Expected: either a hidden section's size does not block saving, or the reason Save is disabled stays visible.
Tests
apps/web/src/components/LoginPageEditor/__tests__/hooks.test.tsx: it('should not block saving on the custom logo size while the login image is hidden, since nothing on screen explains it').
testing/src/specs/admin-branding.spec.ts: test('should allow saving after hiding a login image that has an incomplete custom size').
Suggested fix
Gate the flag on form.showLogo, the same way hasInvalidResourceLinks is gated on form.showResourceLinks. handleSubmit already sends customLogoWidth/customLogoHeight as null when they do not parse, and the panel falls back to the small preset when both are null, so saving in this state is safe.
Activity
fix(web): ignore the custom logo size while the login image is hidden