Skip to content

Commit

Permalink
Rename _ids -> _mask
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Oct 25, 2022
1 parent d4c2063 commit f6f4bee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hooks/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export function useId() {
if (!state._value) {
// Traverse the tree upwards and count the components until we reach
// the root node.
/** @type {import('./internal.d').VNode} */
let root = currentComponent._vnode;
let parent = root._parent;
let i = 0;
Expand All @@ -385,7 +386,7 @@ export function useId() {
}

// Attach the id usage array to the root node and resize it to fit
let ids = root._ids || (root._ids = [0]);
let ids = root._mask || (root._mask = [0]);
while (ids.length < i) {
ids.push(0);
}
Expand Down
4 changes: 4 additions & 0 deletions hooks/src/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export interface Component extends PreactComponent<any, any> {
__hooks?: ComponentHooks;
}

export interface VNode extends PreactVNode {
_mask?: number[];
}

export type HookState =
| EffectHookState
| MemoHookState
Expand Down
1 change: 1 addition & 0 deletions mangle.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"$_depth": "__b",
"$_nextDom": "__d",
"$_dirty": "__d",
"$_mask": "__m",
"$_detachOnNextRender": "__b",
"$_force": "__e",
"$_nextState": "__s",
Expand Down

0 comments on commit f6f4bee

Please sign in to comment.