<?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: mandeepsng</title>
    <description>The latest articles on DEV Community by mandeepsng (@mandeepsng).</description>
    <link>https://dev.to/mandeepsng</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F610474%2F23d19fac-bef1-45c1-b50e-73a6e9ba2a4d.jpeg</url>
      <title>DEV Community: mandeepsng</title>
      <link>https://dev.to/mandeepsng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mandeepsng"/>
    <language>en</language>
    <item>
      <title>Porting an Electron App to Linux: Lessons from My screenshort-app Experience</title>
      <dc:creator>mandeepsng</dc:creator>
      <pubDate>Wed, 16 Sep 2026 13:33:54 +0000</pubDate>
      <link>https://dev.to/mandeepsng/porting-an-electron-app-to-linux-lessons-from-my-screenshort-app-experience-4h3n</link>
      <guid>https://dev.to/mandeepsng/porting-an-electron-app-to-linux-lessons-from-my-screenshort-app-experience-4h3n</guid>
      <description>&lt;p&gt;I spent today getting an Electron app to run smoothly on Linux, and it turned out to be a mix of small gotchas and straightforward fixes. If you're about to port your own Electron app, here are a few things I learned.&lt;/p&gt;

&lt;p&gt;First, the port number. In my rvs-work-inbox app, the default port was fine on macOS but clashed with a service on Linux. I had to change it in the main process config. Lesson: don't assume your port is free across OSes. Check common conflicts early.&lt;/p&gt;

&lt;p&gt;Second, the README. I updated screenshort-app's README with Linux install instructions. That sounds trivial, but it forced me to document the exact dependencies and build steps. On Linux, you often need extra system libraries (like libgtk-3 and libnotify) that aren't required on macOS. If you don't write them down, your future self (or your users) will struggle.&lt;/p&gt;

&lt;p&gt;Third, testing with Postman. I used it to verify API endpoints that the Electron app hits. On Linux, the app's network stack behaves a bit differently, especially with proxies or self-signed certs. Postman helped me isolate whether issues were in the app or the environment.&lt;/p&gt;

&lt;p&gt;Finally, I ran into a phpMyAdmin cookie issue while debugging a local setup. That wasn't directly about Electron, but it reminded me that Linux environments often have stricter cookie and permission settings. Always check your local server config.&lt;/p&gt;

&lt;p&gt;Porting isn't glamorous, but it's mostly about being methodical: test each piece, document everything, and don't assume cross-platform behavior. The good news is that Electron's tooling is mature, so most problems have a known fix. Just be ready to read a few forum threads and tweak your configs.&lt;/p&gt;

&lt;p&gt;If you're doing a Linux port, start with the port, then the dependencies, then the docs. You'll save yourself a lot of head-scratching.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>linux</category>
      <category>electron</category>
    </item>
    <item>
      <title>Fixing a Notification Click Bug in a Tauri + Svelte Desktop App</title>
      <dc:creator>mandeepsng</dc:creator>
      <pubDate>Tue, 15 Sep 2026 10:21:12 +0000</pubDate>
      <link>https://dev.to/mandeepsng/fixing-a-notification-click-bug-in-a-tauri-svelte-desktop-app-2ak7</link>
      <guid>https://dev.to/mandeepsng/fixing-a-notification-click-bug-in-a-tauri-svelte-desktop-app-2ak7</guid>
      <description>&lt;p&gt;Today I finally tracked down a frustrating bug in our office-chat desktop app. When a user clicked a system notification, the app didn't open the right chat thread — or sometimes didn't open at all. It felt like a classic “works on my machine” issue, but it was happening for several users on Windows and macOS.&lt;/p&gt;

&lt;p&gt;The app is built with Tauri (Rust backend) and Svelte (frontend). Notifications are triggered from the Rust side using the &lt;code&gt;tauri-plugin-notification&lt;/code&gt; API. The click event is supposed to emit a custom event back to the frontend, which then navigates to the relevant conversation.&lt;/p&gt;

&lt;p&gt;After digging in, I found two problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The event payload was missing the conversation ID. The Rust code was sending a generic &lt;code&gt;notification-clicked&lt;/code&gt; event without any data, so the frontend had no idea which thread to open.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even when the payload was correct, the Svelte listener was attached too late. The notification click could fire before the Svelte app had fully mounted, so the event was lost.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the first issue, I updated the Rust handler to include the conversation ID in the event payload. That was straightforward — just pass the ID along when creating the notification.&lt;/p&gt;

&lt;p&gt;For the second, I moved the event listener registration into the &lt;code&gt;onMount&lt;/code&gt; lifecycle of the root component, and also added a small queue in the frontend to buffer any events that arrive before the app is ready. That way, no click is ever dropped.&lt;/p&gt;

&lt;p&gt;I also added a quick test with Postman to simulate the notification payload and verify the frontend routing logic. It’s not a full end-to-end test, but it caught a few edge cases.&lt;/p&gt;

&lt;p&gt;The fix is now in a PR and I’m waiting for review. It’s a small change, but it makes the app feel much more responsive. If you’re building a Tauri app with notifications, double-check your event payloads and listener timing — those two are easy to overlook.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tauri</category>
      <category>svelte</category>
      <category>bugfix</category>
    </item>
    <item>
      <title>Implementing a Loading Page State in ReactJS: Enhancing User Experience with Loading Indicators</title>
      <dc:creator>mandeepsng</dc:creator>
      <pubDate>Tue, 20 Feb 2024 07:32:37 +0000</pubDate>
      <link>https://dev.to/mandeepsng/implementing-a-loading-page-state-in-reactjs-enhancing-user-experience-with-loading-indicators-nep</link>
      <guid>https://dev.to/mandeepsng/implementing-a-loading-page-state-in-reactjs-enhancing-user-experience-with-loading-indicators-nep</guid>
      <description>&lt;p&gt;In ReactJS, you can create a loading page state to indicate to users that the application is in the process of loading data or performing an operation. Here's a basic example of how you can implement a loading page state in React:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// State to track loading status&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Simulate data loading delay with setTimeout&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loadData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Set loading state to false after delay&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Simulated loading time: 2000 milliseconds (2 seconds)&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nf"&gt;loadData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Call loadData function when component mounts&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt; &lt;span class="c1"&gt;// Empty dependency array to run effect only once on mount&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loading...&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// Render loading message when loading state is true&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loaded successfully!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// Render content when loading state is false&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We use the &lt;code&gt;useState&lt;/code&gt; hook to manage the loading state, initializing it as &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;We use the &lt;code&gt;useEffect&lt;/code&gt; hook with an empty dependency array to simulate data loading. This effect runs only once when the component mounts.&lt;/li&gt;
&lt;li&gt;Inside the &lt;code&gt;useEffect&lt;/code&gt;, we simulate a loading delay with &lt;code&gt;setTimeout&lt;/code&gt;. After the delay, we update the loading state to &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In the return statement, we conditionally render a loading message or the content based on the value of the &lt;code&gt;loading&lt;/code&gt; state.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can customize the loading message and loading time according to your requirements. Additionally, you can enhance this example by replacing the simulated loading with actual data fetching or other asynchronous operations.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Node.js: 5 Essential Syntax Examples for Beginners</title>
      <dc:creator>mandeepsng</dc:creator>
      <pubDate>Thu, 15 Feb 2024 12:12:16 +0000</pubDate>
      <link>https://dev.to/mandeepsng/nodejs-5-essential-syntax-examples-for-beginners-26ol</link>
      <guid>https://dev.to/mandeepsng/nodejs-5-essential-syntax-examples-for-beginners-26ol</guid>
      <description>&lt;p&gt;Sure, here are five examples of Node.js syntax:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Defining a variable&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using built-in modules&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Creating a function&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using arrow function&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using asynchronous file reading&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

   &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example.txt&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
       &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These examples demonstrate basic Node.js syntax for variable declaration, module import, function creation, arrow functions, and asynchronous file reading using the &lt;code&gt;fs&lt;/code&gt; module.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
