Skip to content

Commit 0073fce

Browse files
committed
ooh it was assuming the model wayy to early
1 parent 98c0e4a commit 0073fce

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

workflow.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ nodes:
2323
steps:
2424
- name: "AI Code Review"
2525
ai:
26-
model: "gpt-4o-mini"
2726
max_tokens: 8000
2827
prompt: |
29-
You are reviewing React component migrations.
30-
Only if you see `react-declassify-disable` or `TODO_this` in the provided files, fix the component to use Hooks.
31-
If the file looks fine and does not have these markers, return immediately with no changes. Do not output any verbose explanations.
28+
You are an expert React migration codemod.
29+
Your job is to fix any remaining issues in this file after an automatic class-to-function component transform.
30+
Look specifically for any `TODO_this` references or `react-declassify-disable` comments.
31+
1. If `TODO_this.shouldComponentUpdate` is used, rewrite the component export to use `React.memo(ComponentName, (prevProps, nextProps) => { ... })`. Make sure to convert any `props` variables and maintain identical behavior. Return `true` if it shouldn't update, `false` if it should update. Wait, `shouldComponentUpdate` returns `true` to update. `React.memo` returns `true` to SKIP update (if props are equal). Keep this in mind!
32+
2. If there are refs exposed via `TODO_this.something`, refactor the functional component to use `React.forwardRef` and expose those elements using `useImperativeHandle(ref, () => ({ get something() { return refName.current; } }))`.
33+
3. Fix any eslint errors you might create (use implicit arrow returns where possible, no trailing commas missing).
34+
35+
OUTPUT INSTRUCTIONS:
36+
If you made changes, output the full updated file content wrapped in a single ```javascript code block.
37+
If the file needs absolutely no changes, you MUST output the exact original file content wrapped in a ```javascript code block.
38+
Do not provide any explanations or markdown other than the code block.
3239

0 commit comments

Comments
 (0)