File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,13 @@ export function Foo() {
171
171
}` ,
172
172
options : [ { allowedServerHooks : [ "useTranslations" ] } ] ,
173
173
} ,
174
+ {
175
+ code : `import {useMemo} from 'react';
176
+ const Button = ({id}) => {
177
+ const memoizedId = useMemo(() => id, [id]);
178
+ return <div id={memoizedId} />;
179
+ }` ,
180
+ } ,
174
181
] ,
175
182
invalid : [
176
183
{
Original file line number Diff line number Diff line change @@ -81,9 +81,8 @@ const create = Components.detect(
81
81
function isClientOnlyHook ( name : string ) {
82
82
return (
83
83
// `useId` is the only hook that's allowed in server components
84
- name !== "useId" &&
85
84
! ( options . allowedServerHooks || [ ] ) . includes ( name ) &&
86
- / ^ u s e [ A - Z ] / . test ( name )
85
+ / ^ u s e (? ! ( I d | M e m o ) $ ) [ A - Z ] / . test ( name )
87
86
) ;
88
87
}
89
88
You can’t perform that action at this time.
0 commit comments