Skip to content

Commit 33b9c95

Browse files
committed
Change setting and getting statements array data in getHooksNames
1 parent a02202a commit 33b9c95

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/backend/helpers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ export const getHooksNames = (elementType: string): Array<string> => {
9191
// * Works for useState hooks
9292
if (hook.id.type === 'ArrayPattern') {
9393
hook.id.elements.forEach((hook) => {
94+
statements.push(`_useWildcard${tsCount}`);
9495
statements.push(hook.name);
95-
// * Unshift a wildcard name to achieve similar functionality as before
96-
statements.unshift(`_useWildcard${tsCount}`);
9796
tsCount += 1;
9897
});
9998
} else {
@@ -111,7 +110,7 @@ export const getHooksNames = (elementType: string): Array<string> => {
111110
}
112111
});
113112
statements.forEach((el, i) => {
114-
if (el.match(/_use/)) hooksNames[el] = statements[i + 2];
113+
if (el.match(/_use/)) hooksNames[el] = statements[i + 1];
115114
});
116115
});
117116
}

0 commit comments

Comments
 (0)