Conversation
Co-authored-by: jan <jan@amann.work>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
useTranslations and useExtracted
|
@cursoragent Do you think changes in this PR noticeably affect perf? Local tests don't show a significant difference … Or would you suggest any optimizations? |
|
Looking at the changes, the performance impact should be negligible for several reasons: AnalysisBefore vs After:
Why the impact is minimal:
VerdictNo optimizations needed. The fix prioritizes correctness and the code is already efficient. Your local tests confirming no significant difference is expected - the change is architecturally cleaner while maintaining the same performance profile. If you wanted to micro-optimize (not recommended as it adds complexity for marginal gain), you could use a Learn more about Cursor Agents |
useTranslations and useExtracteduseExtracted
useExtracteduseExtracted & getExtracted
Refactor SWC plugin to correctly handle multiple
useExtractedandgetExtractedcalls in a single file.Previously, the plugin only processed the first
useExtractedorgetExtractedimport it encountered due to storing hook information as single values and usingbreakstatements. This led to a bug where subsequent calls to these hooks in the same file were not transformed. The fix changes the internal storage from singleOptionvalues to aFxHashMapto track all relevant hook imports and updates the visitor logic to utilize this map for transformations.Note
Track all hook imports via a map and transform every occurrence; add fixtures verifying multiple client/server hooks and update a sourcemap.
packages/swc-plugin-extractor/src/lib.rs):hook_local_names: FxHashMap<Id, HookType>to support multiple imports/aliases.next-intlandnext-intl/serverto record each local and rename touseTranslations/getTranslations(preserving spans/ctxt).tests/fixture/multiple-hookswith input, transformed output, and sourcemap covering multiple client/server hooks and aliases.tests/fixture/alias-hook/output.mapmappings.Written by Cursor Bugbot for commit 325fff7. This will update automatically on new commits. Configure here.