Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charts - replace getResizeObserver #206

Merged
merged 5 commits into from
Jan 17, 2023

Conversation

dlabrecq
Copy link
Member

@dlabrecq dlabrecq commented Jan 11, 2023

Replaced react-chart getResizeObserver with same function from react-core.

Related to PR patternfly/patternfly-react#8533

@dlabrecq dlabrecq force-pushed the 8531-resizeObserver branch 2 times, most recently from 0212010 to 00ebd9d Compare January 11, 2023 22:32
@dlabrecq dlabrecq changed the title Charts: react-chart replaced getResizeObserver Charts - replace getResizeObserver Jan 12, 2023
Copy link
Collaborator

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a likelihood that react-charts' getResizeObserver was being imported by anyone else, and since the README includes an "Examples" section for in and output, it might be worth including a codemod that can be ran to fix the import from '@patternfly/react-charts' to @patternfly/react-core'.

Alternatively we could just mention the change and remove the Examples section in the README. @gitdallas wdyt?

packages/pf-codemods/README.md Outdated Show resolved Hide resolved
@gitdallas
Copy link
Contributor

gitdallas commented Jan 13, 2023

@thatblindgeye - i believe nicole just let dan know he should either create a story or at least update the readme for this, but we definitely don't want to let it fall through the cracks.

maybe one of us could take over creating the codemod - unless you want to, @dlabrecq

no-experimental-imports for v4 rules would be a good reference for creating this codemod

@dlabrecq
Copy link
Member Author

Per Nicole's instructions, I created issue patternfly/patternfly-react#8533 and updated the README in this repo. I wasn't planning to create and test codemods, so I'm fine having someone else implement that.

Copy link
Collaborator

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! @gitdallas unless you'd want to add a codemod and tests for this, I could push those changes to this PR

@thatblindgeye
Copy link
Collaborator

@gitdallas let me know if you think the codemod should be simpler and just update the import path. Tried taking into account other scenarios with what I pushed.

fixes.push(
fixer.insertTextAfterRange(
node.range,
"import {getResizeObserver} from '@patternfly/react-core';"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we sneak a \n in before "import"?

@gitdallas
Copy link
Contributor

thanks, lgtm. while you resolve - this would be a good opportunity to add to the test.tsx file btw and see the output with yarn test:single

@thatblindgeye
Copy link
Collaborator

@gitdallas tried out the test.tsx file, pretty neat! Wasn't sure if we should keep additions saved as part of PRs or if it's better just to try locally so I didn't include it here.

@dlabrecq
Copy link
Member Author

@thatblindgeye Thank you for adding the codemods.

@gitdallas gitdallas merged commit 5b7fece into patternfly:main Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants