usePermission does not invalidate an outstanding navigator.permissions.query() when its effect is cleaned up.
I reproduced two cases against master 2ca6f6c using the existing React hook test runner and manually resolved query promises:
- Mount the hook, unmount before the query resolves, then resolve it.
PermissionStatus.addEventListener('change', ...) is still called, but the cleanup that would remove it has already run.
- Start a geolocation query, rerender with notifications, resolve notifications to
granted, then resolve the earlier geolocation query to denied. The hook returns denied from the stale query and subscribes to that old status.
Expected: ignore a query result whose effect has been cleaned up, while retaining normal subscription cleanup for a query that resolves while active.
The regression tests fail on both cases; existing DOM/SSR cases and the resolved-query cleanup control pass. I am preparing a focused fix with an effect-local active flag, without changing the public state union, permission API availability policy, or query rejection behavior. This is separate from #1711 (missing Permissions API) and #1563 (Safari change notifications). No physical-device reproduction is claimed.
usePermissiondoes not invalidate an outstandingnavigator.permissions.query()when its effect is cleaned up.I reproduced two cases against master 2ca6f6c using the existing React hook test runner and manually resolved query promises:
PermissionStatus.addEventListener('change', ...)is still called, but the cleanup that would remove it has already run.granted, then resolve the earlier geolocation query todenied. The hook returnsdeniedfrom the stale query and subscribes to that old status.Expected: ignore a query result whose effect has been cleaned up, while retaining normal subscription cleanup for a query that resolves while active.
The regression tests fail on both cases; existing DOM/SSR cases and the resolved-query cleanup control pass. I am preparing a focused fix with an effect-local active flag, without changing the public state union, permission API availability policy, or query rejection behavior. This is separate from #1711 (missing Permissions API) and #1563 (Safari change notifications). No physical-device reproduction is claimed.