Skip to content

Commit 4e6363d

Browse files
committed
Simplify hash algorithm in A2UIViewer
1 parent 46992cc commit 4e6363d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

renderers/react/src/core/A2UIViewer.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ export function A2UIViewer({
9090
const definitionKey = `${root}-${JSON.stringify(components)}`;
9191
let hash = 0;
9292
for (let i = 0; i < definitionKey.length; i++) {
93-
const char = definitionKey.charCodeAt(i);
94-
hash = (hash << 5) - hash + char;
95-
hash = hash & hash;
93+
hash = 31 * hash + definitionKey.charCodeAt(i);
9694
}
9795
return `surface${baseId.replace(/:/g, '-')}${hash}`;
9896
}, [baseId, root, components]);

0 commit comments

Comments
 (0)