()
| 418 | |
| 419 | /** @type {() => string} */ |
| 420 | export function useId() { |
| 421 | /** @type {import('./internal').IdHookState} */ |
| 422 | const state = getHookState(currentIndex++, 11); |
| 423 | if (!state._value) { |
| 424 | // Grab either the root node or the nearest async boundary node. |
| 425 | /** @type {import('./internal').VNode} */ |
| 426 | let root = currentComponent._vnode; |
| 427 | while (root !== null && !root._mask && root._parent !== null) { |
| 428 | root = root._parent; |
| 429 | } |
| 430 | |
| 431 | let mask = root._mask || (root._mask = [0, 0]); |
| 432 | state._value = 'P' + mask[0] + '-' + mask[1]++; |
| 433 | } |
| 434 | |
| 435 | return state._value; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * After paint effects consumer. |
searching dependent graphs…