<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shubhamak2</title>
    <description>The latest articles on DEV Community by shubhamak2 (@shubhamak2).</description>
    <link>https://dev.to/shubhamak2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F490451%2F96dc1b48-df37-4d36-8b2f-fade25cb2edf.png</url>
      <title>DEV Community: shubhamak2</title>
      <link>https://dev.to/shubhamak2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubhamak2"/>
    <language>en</language>
    <item>
      <title>Electron App: How to authorize domain on Firebase</title>
      <dc:creator>shubhamak2</dc:creator>
      <pubDate>Thu, 24 Nov 2022 08:22:25 +0000</pubDate>
      <link>https://dev.to/shubhamak2/electron-app-how-to-authorize-domain-on-firebase-21en</link>
      <guid>https://dev.to/shubhamak2/electron-app-how-to-authorize-domain-on-firebase-21en</guid>
      <description>&lt;p&gt;In my electron app, I have integrated the firebase google sign-in authentication method. This method is working properly in the local environment. But after packaging the application (for Linux environment), I am getting an error '&lt;strong&gt;Error while login into Gmail account FirebaseError: Firebase: Error (auth/unauthorized-domain)&lt;/strong&gt;'. When I tried to find the cause of this error, I found that we have to add the respective domain to the authorization tab but the firebase app domain is already added in settings. As you can see in the screenshot.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw82d6k29mtktirldcb76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw82d6k29mtktirldcb76.png" alt="Image description" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What else do I need to add here in the domain setting?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
    </item>
    <item>
      <title>React Service worker: Load new content without forcing the user to close the tab ?</title>
      <dc:creator>shubhamak2</dc:creator>
      <pubDate>Thu, 15 Oct 2020 10:39:04 +0000</pubDate>
      <link>https://dev.to/shubhamak2/react-service-worker-load-new-content-without-forcing-the-user-to-close-the-tab-2ogp</link>
      <guid>https://dev.to/shubhamak2/react-service-worker-load-new-content-without-forcing-the-user-to-close-the-tab-2ogp</guid>
      <description>&lt;p&gt;I'm working on implementing the service worker concept in react and I have added all the configurations suggested in the Link &lt;a href="https://create-react-app.dev/docs/making-a-progressive-web-app/"&gt;https://create-react-app.dev/docs/making-a-progressive-web-app/&lt;/a&gt; but the problem here is that for displaying the new content (when the network changed from offline to online), I've to display user to message like 'New content is available once existing tabs are closed.' So here we're forcing the user to close the page for displaying new content. Even the refresh option is also not working here.&lt;/p&gt;

&lt;p&gt;Check the below method - (This is a method created when we build react app using create-react-app, the method can be found in react-app/service-worker.js)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function registerValidSW(swUrl, config) {
  navigator.serviceWorker
    .register(swUrl)
    .then(registration =&amp;gt; {
      registration.onupdatefound = () =&amp;gt; {
        const installingWorker = registration.installing;
        if (installingWorker == null) {
          return;
        }
        installingWorker.onstatechange = () =&amp;gt; {
          if (installingWorker.state === 'installed') {
            if (navigator.serviceWorker.controller) {
              // At this point, the updated precached content has been fetched,
              // but the previous service worker will still serve the older
              // content until all client tabs are closed.
              console.log(
                'New content is available and will be used when all ' +
                  'tabs for this page are closed. See'
              );

              // Execute callback
              if (config &amp;amp;&amp;amp; config.onUpdate) {
                config.onUpdate(registration);
              }
            } else {
              // At this point, everything has been precached.
              // It's the perfect time to display a
              // "Content is cached for offline use." message.
              console.log('Content is cached for offline use.');

              // Execute callback
              if (config &amp;amp;&amp;amp; config.onSuccess) {
                config.onSuccess(registration);
              }
            }
          }
        };
      };
    })
    .catch(error =&amp;gt; {
      console.error('Error during service worker registration:', error);
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can clearly see the console&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;New content is available and will be used when all tabs for &amp;gt; this page are closed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What is the best way to achieve this? So only refreshing the page, we can update the previously stored cache.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>serviceworker</category>
    </item>
  </channel>
</rss>
