Issue with Safari and Service Worker Push Notification Opening Window

I’m adding push notifications to my React Web App and I’m having some issues with Safari. First here is the click event listener in my service worker js file (sw.js):

self.addEventListener('notificationclick', (event) => {
  const data = event.notification.data;
  const url = data.url || 'http://localhost:3356';

  console.log({ data, url });

  event.notification.close();

  event.waitUntil(
    self.clients
      .matchAll({
        type: 'window',
        includeUncontrolled: true,
      })
      .then((clientList) => {
        console.log('total clients: ', clientList.length);
        for (const client of clientList) {
          console.log({ clientUrl: client.url });
          if (client.url === url + '/' && 'focus' in client)
            return client.focus();
        }
        if (self.clients.openWindow) {
          console.log('Opening a new window', url);
          return self.clients.openWindow(url);
        }
        console.log('No clients to focus');
        return;
      })
      .catch((error) => console.log({ error }))
  );

This is mostly working fine specially in chrome. However the issue I’m having in Safari is that if the web app is not open in any window and/or tab when I click on the notification, safari does not open the web app I’m taken to the last active tab/window. If I have multiple tabs open and one of the tabs is the WebApp then Safari switches and focuses to the correct tab. But it seems that clients.openWindow is not working. the Log Message ‘Opening New Window’ does show up and no error logs shows up.

Any help would be greatly appreciated. Thanks