relates to #4647: enable parameter edit#150
Conversation
160e22c to
29ebf30
Compare
vladavoX
left a comment
There was a problem hiding this comment.
Review
Overview
Implements parameter editing for parametrized layers. Key additions:
ParameterDialog— new modal for editing static/dynamic parameter settings (value, parameter name with regex validation, default value, mandatory flag)SortableLayerItem— layer rows extracted into a sortable component, enabling layer drag-and-drop reorderingCheckbox— upgraded to support controlled (checked) alongside uncontrolled (defaultChecked)ensureHashPrefix/stripHashPrefix— symmetric util helpers for#-prefixed valuesLayerBase.label— new required field on the type
Issues
Bug — Static save retains stale dynamic fields (ParameterDialog.tsx:158-170)
When saving in Static mode, the spread carries over mandatory and defaultValue from the previous Dynamic configuration:
: {
...currentParametrization, // ← keeps mandatory, defaultValue from dynamic mode
expression: false,
value: staticValue,
};Any downstream code reading mandatory or defaultValue without first checking expression === true will see stale data. These should be explicitly cleared in the static branch.
Edit button not respecting disabled prop (ParametrizedLayers.tsx:566-572)
The Edit button has no disabled attribute, so users can open the parameter dialog even when the parent's disabled prop is true. The drag handle correctly checks isFilterActive — the edit button should too.
PARAM_NAME_REGEX defined locally instead of in utils.ts (ParameterDialog.tsx:112)
SCRIPT_PARAMETER_NAME_REGEX lives in utils.ts. PARAM_NAME_REGEX should also live there so both are in one place and accessible to any future validation logic.
defaultV is an opaque variable name (ParameterDialog.tsx:139)
defaultV is unclear at a glance. Rename to paramDefaultValue or similar — defaultValue is already destructured above, so a distinct but readable name avoids both shadowing and the abbreviation.
Code Quality
checkPropsspread in Checkbox — clean solution to the uncontrolled/controlled switch without duplicating the<input>.keytrick onParameterDialog(ParametrizedLayers.tsx:865) — correct pattern to reset dialog state on open/close; intentional and clear.handleLayerDragEndclears selection — reasonable UX; drag reorders so prior selection is ambiguous.isFilterActivecomputation correctly gates drag whendisabled, filter, or type query is active.- State initialization in
ParameterDialog— relies onkeyprop to reset when reopened for a different layer; valid approach.
d6aeb1f to
673cd6a
Compare
5897cfa to
5d0c8fe
Compare
673cd6a to
ba3a055
Compare
5d0c8fe to
7c5a212
Compare
Summary
Type of change
Related issue
Testing
yarn test)After Effects version tested:
OS tested on:
Screenshots
Checklist
yarn biomepasses (oryarn biome:fixwas run)yarn buildcompletes without errors