Repository navigation
fix: enforce the clone name limit in the dialog and type check the client in CI - #28
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #26.
FormCloneComponentpassedmaxLength={200}to the adminInput. Its props expose only a fixed list of native attributes (NativeInputPropsin@kentico/xperience-admin-components30.11.0), andmaxLengthisn't on that list. Two consequences:<input>has nomaxlength, 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 --noEmitfailed onmain. The webpack build uses Babel's TypeScript preset, which strips types without checking them, so neither the build nor CI noticed.Changes:
FormCloneConstants.MaximumDisplayNameLengththrough a new client property, so the number lives in one place.submitchecks the length too.typechecknpm script (tsc --noEmit) runs in CI's minimum-compatibility job before the client build, so client type errors now fail CI.Client/distbundle.Test plan
Reproduced on
mainin the DancingGoat admin: the Clone form input rendered with nomaxlength(maxLength === -1) and accepted 250 characters.npm run typecheckpasses (it failed onmain).npm run buildsucceeds.dotnet test: 107/107 pass, including a new test that the client receives the server's limit.dotnet format --exclude ./examples/** --verify-no-changesis clean.Live in the admin (dialog cancelled each time; nothing cloned):
Coffee sample list (copy))