Skip to content

fix: enforce the clone name limit in the dialog and type check the client in CI - #28

Merged
andresvillenas merged 1 commit into
mainfrom
fix/client-type-check
Sep 24, 2026
Merged

andresvillenas merged 1 commit into
mainfrom
fix/client-type-check

Conversation

@andresvillenas

Copy link
Copy Markdown
Collaborator

Summary

Fixes #26.

FormCloneComponent passed maxLength={200} to the admin Input. Its props expose only a fixed list of native attributes (NativeInputProps in @kentico/xperience-admin-components 30.11.0), and maxLength isn't on that list. Two consequences:

  • At runtime, the limit did nothing. The rendered <input> has no maxlength, and the field accepts names of any length. The server (FormCloneName.Normalize) still rejected names over 200 characters, but only after the administrator selected Clone. No invalid data could be saved.
  • tsc --noEmit failed on main. The webpack build uses Babel's TypeScript preset, which strips types without checking them, so neither the build nor CI noticed.

Changes:

  • The dialog gets the limit from FormCloneConstants.MaximumDisplayNameLength through a new client property, so the number lives in one place.
  • The dialog trims the name and measures it like the server does. When it's too long, the field is marked invalid with the server's message ("Form name must be 200 characters or fewer.") and Clone is disabled. submit checks the length too.
  • A new typecheck npm script (tsc --noEmit) runs in CI's minimum-compatibility job before the client build, so client type errors now fail CI.
  • Rebuilt Client/dist bundle.

Test plan

  • Reproduced on main in the DancingGoat admin: the Clone form input rendered with no maxlength (maxLength === -1) and accepted 250 characters.

  • npm run typecheck passes (it failed on main). npm run build succeeds.

  • dotnet test: 107/107 pass, including a new test that the client receives the server's limit. dotnet format --exclude ./examples/** --verify-no-changes is clean.

  • Live in the admin (dialog cancelled each time; nothing cloned):

    Name Clone Inline message
    Default (Coffee sample list (copy)) enabled none
    201 characters disabled shown
    Exactly 200 characters enabled none
    200 characters + trailing spaces enabled (trimmed like the server) none

…ient in CI

The Clone form dialog passed maxLength to the admin Input component,
which does not accept or forward it. The field took names of any length
and only the server rejected them after Clone was selected. It also made
tsc --noEmit fail, which went unnoticed because the webpack build strips
types without checking them.

The dialog now receives the limit from FormCloneConstants, shows the
server's message inline, and disables Clone while the trimmed name is too
long. A typecheck npm script runs in CI before the client build.

Fixes #26
@andresvillenas andresvillenas added the bug Something isn't working label Sep 24, 2026
@andresvillenas
andresvillenas merged commit b1adb4f into main Sep 24, 2026
3 checks passed
@andresvillenas
andresvillenas deleted the fix/client-type-check branch September 24, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Client type check fails and is not run in CI

1 participant