Skip to content

Misc - toggle props codemod enhancement #295

@gitdallas

Description

@gitdallas

Follow up to breaking change PR patternfly/patternfly-react#8664

Enhance original issue so that the codemods only trigger if there is an applicable prop (onToggle), also we could look into a fixer:

onToggle={this.handleOnToggle}
to
onToggle={(event, isOpen) => this.handleOnToggle(isOpen)}
(although we'd have to make sure that handleOnToggle was actually taking the parameter, can we do this?)

and

onToggle={ (isOpen) => { ... } }
to
onToggle={ (event, isOpen) => { ... }}

other places it might not need a fix at all, if inline function and no params given, can ignore:

    isOpen={isOpen}
    onToggle={() => setIsOpen(!isOpen)}

Required actions:

  1. Build codemod
  2. Build test
  3. Update readme with description & example

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions