<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Swapnil Solanke on Medium]]></title>
        <description><![CDATA[Stories by Swapnil Solanke on Medium]]></description>
        <link>https://medium.com/@swapnilsolanke?source=rss-59fbf767f62d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OFhpwSyvGNFgf8_R.</url>
            <title>Stories by Swapnil Solanke on Medium</title>
            <link>https://medium.com/@swapnilsolanke?source=rss-59fbf767f62d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:34:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@swapnilsolanke/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Angular PWA Helped Improve My App’s Load Time]]></title>
            <link>https://medium.com/@swapnilsolanke/how-angular-pwa-helped-improve-my-apps-load-time-a0a1b1b991d6?source=rss-59fbf767f62d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0a1b1b991d6</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[pwa]]></category>
            <category><![CDATA[service-worker]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Swapnil Solanke]]></dc:creator>
            <pubDate>Fri, 06 Sep 2024 08:22:01 GMT</pubDate>
            <atom:updated>2024-09-06T08:41:46.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Angular+PWA" src="https://cdn-images-1.medium.com/max/186/1*svAIYEtYnghJwDJf2g_x2g.png" /></figure><p>I was working on a web application that supported around 60 languages, managing translations for labels, error messages, names, and menus. Initially, we focused on completing the app using a conventional approach due to tight deadlines, fetching all translation data from an API during the app load. This caused slow initial loading, especially noticeable on slower networks.</p><h4>Challenges Faced</h4><ul><li><strong>Slow Initial Load</strong>: Fetching large translation data during startup caused significant delays, as it was crucial for rendering the UI correctly.</li><li><strong>Redundant API Calls</strong>: Each time the app loaded, it called the same API, leading to repetitive requests and slower performance.</li></ul><h4>Solution: Implementing Angular PWA Caching</h4><p>To address these performance issues, I implemented Angular’s PWA (Progressive Web App) features, which use Service Workers to cache API responses and static assets, improving load times and providing offline capabilities.</p><h4>Steps to Add Angular PWA and Configure Caching</h4><ol><li><strong>Install Angular PWA</strong>:<br>To add PWA support, run the command:</li></ol><pre>ng add @angular/pwa</pre><p>This command sets up the Service Worker and necessary configurations for caching.</p><p><strong>2. Configure </strong><strong>ngsw-config.json for Caching</strong>:<br>The ngsw-config.json file defines caching strategies for API data and assets. Below are the caching configurations that improved the app performance:</p><ul><li><strong>Caching Translation API Data</strong>:<br>This configuration caches the translation API responses, so the data is fetched only once and reused, minimizing load time.</li></ul><pre>{<br>  &quot;index&quot;: &quot;/index.html&quot;,<br>  &quot;dataGroups&quot;: [<br>    {<br>      &quot;name&quot;: &quot;translations&quot;,<br>      &quot;urls&quot;: [&quot;/api/translations/**&quot;],<br>      &quot;cacheConfig&quot;: {<br>        &quot;strategy&quot;: &quot;performance&quot;,<br>        &quot;maxSize&quot;: 50,<br>        &quot;maxAge&quot;: &quot;1d&quot;<br>      }<br>    }<br>  ]<br>}</pre><ul><li><strong>Strategy</strong>: performance - First tries to serve data from the cache and fetches updates in the background.</li><li><strong>Max Age</strong>: Cached data is kept for one day before it is refreshed.</li></ul><p>Adjust the urls, strategy, maxSize, and maxAge values to fit your application&#39;s specific requirements for caching and performance.</p><p><strong>Caching Static Assets</strong>:<br>Caching static assets like CSS, JS, and images improved repeat load times.</p><pre>{<br>  &quot;assetGroups&quot;: [<br>    {<br>      &quot;name&quot;: &quot;app-assets&quot;,<br>      &quot;installMode&quot;: &quot;prefetch&quot;,<br>      &quot;resources&quot;: {<br>        &quot;files&quot;: [&quot;/assets/**&quot;, &quot;/*.css&quot;, &quot;/*.js&quot;]<br>      }<br>    }<br>  ]<br>}</pre><p><strong>Install Mode</strong>: prefetch - Downloads resources immediately after the service worker is installed.</p><p><strong>3. Build and Deploy the Application</strong>:<br>After configuring caching, build the app using:</p><pre>ng build --configuration production</pre><p>Deploy the app to ensure the Service Worker is active.</p><p>Initially, I thought about using HTTP Interceptors for caching. However, Angular PWA Service Workers achieved better results with less code. The Service Worker handles caching automatically.</p><p><strong>But HTTP Interceptors can still be helpful for:</strong></p><ul><li><strong>Custom Caching</strong>: Special handling for certain requests.</li><li><strong>Cache Management</strong>: Clearing or updating cache when needed.</li></ul><p>While PWA Service Workers cover most cases efficiently, HTTP Interceptors can provide additional flexibility.</p><h4>Note on Translation Handling</h4><p>For handling language translations, I used @ngx-translate/core. This topic is covered in more detail separately and will be discussed in another article. The key takeaway is that Angular PWA caching can be combined effectively with such libraries to optimize performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0a1b1b991d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating the Container and Presentational Component Architecture: My Interview Experience and Key…]]></title>
            <link>https://medium.com/@swapnilsolanke/navigating-the-container-and-presentational-component-architecture-my-interview-experience-and-key-03740ea70e03?source=rss-59fbf767f62d------2</link>
            <guid isPermaLink="false">https://medium.com/p/03740ea70e03</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[interview-questions]]></category>
            <dc:creator><![CDATA[Swapnil Solanke]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 05:33:22 GMT</pubDate>
            <atom:updated>2024-08-29T07:07:18.997Z</atom:updated>
            <content:encoded><![CDATA[<h3>Navigating the Container and Presentational Component Architecture: My Interview Experience and Key Takeaways</h3><p>During a recent interview, I was asked about the container and presentational component architecture, a topic that’s frequently discussed in the context of modern front-end development. My response was mostly guided by interpreting the names of these components, as I hadn’t deeply read about this specific pattern — or perhaps had forgotten the details over time.</p><p>In technical discussions, we often find ourselves intimidated by terms like “patterns” or “architectures.” These words can sound complex and daunting, making us second-guess our knowledge, even when we intuitively understand the concepts. This was exactly my experience; I described the components using plain English, focusing on their roles, and it turned out to be accurate. The interviewer picked up on my understanding, even if my vocabulary wasn’t the most technical.</p><p>Since then, I’ve revisited the concept to solidify my knowledge and share it in technical terms, making it easier to grasp for anyone who might feel similarly overwhelmed by the jargon.</p><p><strong>Understanding Container and Presentational Components</strong></p><p>The <strong>container and presentational component architecture</strong> is a pattern commonly used in frameworks like React and Angular to create clean, maintainable, and reusable code. Here’s a breakdown of these components:</p><p><strong>Presentational Components (Dumb Components)</strong>:</p><p><strong>Purpose</strong>: Focused on how things look. They are responsible for rendering UI and handling user interactions.</p><p><strong>Characteristics</strong>:</p><ul><li>Receive data through @Input() (in Angular) or props (in React).</li><li>Emit events using @Output() or callbacks to inform the container component of user actions.</li><li>Do not manage or fetch data; instead, they rely on the container component for data and actions.</li><li>Examples include buttons, forms, and simple layout components that don’t contain business logic.</li><li><strong>Analogy</strong>: Think of them as “dumb” because they don’t understand the data they display; they just present what’s given.</li></ul><p><strong>Container Components (Smart Components)</strong>:</p><ul><li><strong>Purpose</strong>: Focused on how things work. They manage state, handle data fetching, and pass data to presentational components.</li><li><strong>Characteristics</strong>:</li><li>Interact with services, APIs, or global state management like NgRx or Redux.</li><li>Make decisions about which data to pass to presentational components and how to respond to user actions.</li><li>Contain more complex logic and are less reusable compared to presentational components.</li><li><strong>Analogy</strong>: They are the “brains” behind the UI, making decisions and managing data flow.</li></ul><h3>Why This Pattern Matters</h3><p>The distinction between these components is important because it helps in keeping your code organized. Presentational components can be reused across different parts of your application without needing to know about the application’s data flow, making your UI more modular and maintainable. Container components, on the other hand, handle the heavy lifting of data management and can be more complex, but they keep the data logic separate from the UI.</p><h3>My Takeaway</h3><p>The key takeaway for me was that, even if you haven’t memorized every pattern, understanding the basic principles can carry you through technical discussions. It’s okay if your vocabulary isn’t filled with technical jargon; what matters most is your grasp of the underlying concepts. After all, the purpose of patterns like container and presentational components is to simplify and organize our code — not to complicate our conversations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03740ea70e03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>