refactor(ui-react): split useCopy hook into its own file#6167
Open
refactor(ui-react): split useCopy hook into its own file#6167
Conversation
Keeps ClipboardProvider.tsx as a component-only module so react-refresh/only-export-components no longer warns, and lets HMR fast-refresh the provider cleanly.
|
Claude finished @luizhf42's task in 1m 9s —— View job Code Review CompleteReviewed 5 files across code quality, security, testing, language patterns, and architecture — no issues found. The code looks good as-is. Summary: Clean mechanical refactoring that moves If you push additional changes and want a new review, tag |
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.
What
Move the
useCopyhook and itsClipboardContextout ofClipboardProvider.tsxinto a dedicatedhooks/useCopy.tsmodule.Why
ClipboardProvider.tsxexported a component, a hook, and an interfacefrom the same file, tripping
react-refresh/only-export-components:Beyond the lint noise, the mixed exports broke HMR for the provider —
editing it triggered a full reload instead of a fast refresh.
Changes
ClipboardContext, its value type,and the
useCopyhook. The context is exported so the provider canconsume it.
ClipboardContextfrom@/hooks/useCopy.useCopyfrom@/hooks/useCopyinstead of the provider file.Testing
npm run lint— noreact-refreshwarning onClipboardProvider.tsxnpx vitest run src/components/common/__tests__/ClipboardProvider.test.tsx src/components/common/__tests__/CopyWarning.test.tsx— 33 tests pass