I have a common serviceworker escenario, where I want catch a notification click and focus the tab where the notification has come from. However, clients variable is always
Try making the service worker immediately claim the page. E.g.:
self.addEventListener('install', event => event.waitUntil(self.skipWaiting()));
self.addEventListener('activate', event => event.waitUntil(self.clients.claim()));
For a more complex example, see https://serviceworke.rs/immediate-claim.html.