<?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 Vishnu Teja Bandi on Medium]]></title>
        <description><![CDATA[Stories by Vishnu Teja Bandi on Medium]]></description>
        <link>https://medium.com/@vishnutejab99?source=rss-24f5e1f22f8e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VQ-fSjPIpMDrpETf</url>
            <title>Stories by Vishnu Teja Bandi on Medium</title>
            <link>https://medium.com/@vishnutejab99?source=rss-24f5e1f22f8e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:07:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishnutejab99/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 Not To Vue: 3 Common Vue JS Mistakes That One Should Avoid]]></title>
            <link>https://medium.com/fasal-engineering/how-not-to-vue-3-common-vue-js-mistakes-that-one-should-avoid-a1011e31f793?source=rss-24f5e1f22f8e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1011e31f793</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[vue-2]]></category>
            <category><![CDATA[vue-3]]></category>
            <dc:creator><![CDATA[Vishnu Teja Bandi]]></dc:creator>
            <pubDate>Wed, 02 Nov 2022 07:13:43 GMT</pubDate>
            <atom:updated>2022-11-02T07:13:43.814Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://vuejs.org/">VueJS</a> is a very popular JavaScript library for building user interfaces and has been gaining a lot of traction in recent years. I have been using Vue for more than a year and the experience has been fascinating. With that experience, I am sharing 3 very common mistakes that one should avoid while working with Vue JS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VM0RcsbLcizYC3T6NQHhiQ.png" /></figure><h3>1. Making all the data reactive.</h3><p>Consider this example where a list of users is rendered at the click of a button. With the click of a button, more data gets pushed into the <em>users</em> array, and the rendered list increases in size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sAdmMaQ5BHRmRtjRp-AJ4A.png" /></figure><p>In this example, we don’t need reactivity for each user-item as we are only displaying users here. Since <a href="https://v2.vuejs.org/v2/guide/reactivity.html#How-Changes-Are-Tracked">Vue is <em>deeply </em>reactive</a> by default it also watches for the changes in each user-item by adding setters and getters deeply in each user-item, this process increases the rendering time and memory consumption.</p><p>To avoid this, we can use the<em> </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze"><strong><em>freeze</em></strong></a><strong> method of an Object</strong> type to make the array immutable which makes the Vue Engine avoid adding setters and getters to the array items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_GGV4PzlrGdxvh-Vi-NZQA.png" /><figcaption>using Object.freeze() to control reactivity and improve performance</figcaption></figure><h3><strong>2. Using methods instead of computed</strong></h3><p>The below component gets re-rendered every second as the <em>index</em> gets incremented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*0yTWfO6bUCY7xAdh2kAGBQ.png" /><figcaption>computed vs methods</figcaption></figure><p>Since the computed property gets cached the logic of the computed property will not be run every time the component is rendered, but only when its dependencies(<em>firstName</em> and <em>lastName</em> in this case) change.</p><p>The method here runs every time the component is rendered, which will be every second. The image below shows the logs generated by this component over a span of ~1439 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZSMdaX2wlsCeouN1XgnbA.png" /></figure><p><strong>Avoid calling methods directly in the template in components that get re-rendered frequently.</strong></p><h3>3. Static properties in data</h3><p>The previous example has used two static properties in data(<em>firstName</em> and <em>lastName</em>) for simplicity reasons.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F8JW7RNwnggNuZvyNM9%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Foscars-academy-awards-oscars-2019-8JW7RNwnggNuZvyNM9&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2F8JW7RNwnggNuZvyNM9%2Fgiphy.gif%3Fcid%3D790b7611aefb42c4ccc94a43434238bc5173a175f85cb682%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="223" frameborder="0" scrolling="no"><a href="https://medium.com/media/92d01ff371a3bebdcc5aebe5b083857e/href">https://medium.com/media/92d01ff371a3bebdcc5aebe5b083857e/href</a></iframe><p>Static properties in data should be avoided because VueJS adds a setter and getter deeply(by default) to every property in data to watch the changes. If these properties are not going to be changed in the component’s lifecycle why make the Vue engine watch for changes?</p><p><strong>Avoid using properties in data that are not going to be changed in the component’s lifecycle.</strong></p><p>So that’s all from my side, if you have any questions then please ask them in the comments, I will be very happy to answer those.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1011e31f793" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fasal-engineering/how-not-to-vue-3-common-vue-js-mistakes-that-one-should-avoid-a1011e31f793">How Not To Vue: 3 Common Vue JS Mistakes That One Should Avoid</a> was originally published in <a href="https://medium.com/fasal-engineering">Fasal Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to resolve the Hot Module Replacement issue while testing your Vue-Meteor App on Actual Device]]></title>
            <link>https://medium.com/fasal-engineering/workaround-for-hmr-dev-server-url-undefined-when-working-with-meteor-vue-and-cordova-93e2ee613e69?source=rss-24f5e1f22f8e------2</link>
            <guid isPermaLink="false">https://medium.com/p/93e2ee613e69</guid>
            <category><![CDATA[cordova]]></category>
            <category><![CDATA[hmr]]></category>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Vishnu Teja Bandi]]></dc:creator>
            <pubDate>Fri, 16 Apr 2021 11:27:49 GMT</pubDate>
            <atom:updated>2021-04-19T15:15:19.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*GH2kXbh9bSwn1bYQn6rclg.jpeg" /></figure><p>When you are trying to run your Vue + Meteor app on a mobile platform using Cordova, if your app which is running okay in the browser is facing issues like Styles not coming up or <em>MeteorWebApp: Asset /socket.io/ not found in the bundle, </em>below workaround, might help you.</p><p>We at Fasal recently started using the VueJS front-end library in our meteor app. I tried running our app on mobile(Android and IOS) using Cordova. I noticed that styles for VueJs components are not coming up. This is not the case for other platforms.</p><p>I searched for it and I found out that styles for VueJs components in the Meteor are loaded through <em>Hot Module Replacement</em> (<strong>HMR</strong>) during development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o33qKX14oL9sF_JK.png" /></figure><blockquote>According to Webpack, “<a href="https://webpack.js.org/concepts/hot-module-replacement/"><strong>Hot Module Replacemen</strong></a><strong>t</strong> (HMR) exchanges, adds, or removes <strong>modules</strong> while an application is running, without a full <strong>reload</strong>. This can significantly speed up development in a few ways: Retain application state which is lost during a full <strong>reload</strong>.”</blockquote><p>I tried running our app without HMR which can be done by running our app after setting the NO_HMR or <a href="https://guide.meteor.com/deployment.html#never-use-production-flag">— productio</a>n flags as shown below.</p><pre>$ export NO_HMR=1<br>$ meteor run android-device --mobile-server=http://&lt;IPv4 of your computer&gt;:3000</pre><pre>---OR----<br>$ meteor run --production android-device --mobile-  server=http://&lt;IPv4 of your computer&gt;:3000</pre><p>The styles for our VueJs components are now working as expected. This meant that there is something wrong with HMR. As far as we are concerned, If we want to make a mobile-based feature (eg: QR scanner) we have to rebuild for mobile every time we change something in our code, which happens a lot during development and that’s a lot of time waste.</p><p>And so, I opened our chrome dev tools to inspect the app when run on mobile and found this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PY755SiT70YpmkcOh9h84A.png" /></figure><p>This means that the client(mobile app) is listening to “undefined” for hot module replacement. The code where the HMR server URL is assigned to the meteor client is in the package <a href="https://github.com/meteor-vue/vue-meteor/tree/master/packages/vue-component-dev-client/client"><strong><em>akryum:vue-component-dev-client</em></strong></a><strong><em>.</em></strong></p><p>Alternatively, you can see the source code by clicking the link shown alongside the log above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqZq7vxbdx2RkUdHeXMEMg.png" /><figcaption>vue-component-dev-client/client/dev-client.js</figcaption></figure><p>Since devUrl is <em>undefined</em>, the object <em>__meteor_runtime_config__</em> does not have a property named VUE_DEV_SERVER_URL. This is only happening on mobile platforms. In the other platforms, VUE_DEV_SERVER_URL is being set by default to ( can be changed manually) -</p><pre>http://&lt;IPv4 of your computer&gt;:&lt;port on which your app is running + 3&gt;</pre><h4>What Exactly Is Happening here?</h4><p>When we run the command,</p><pre>meteor run android-device --mobile- server=http://&lt;IPv4 of your computer&gt;:3000</pre><p>meteor creates two server instances which serve at localhost:3000 and at http://&lt;IPv4 of your computer&gt;:3000. You can check this by going to these URLs in your browser. The mobile app will have the ROOT_URL set to http://&lt;IPv4 of your computer&gt;:3000. In the mobile platform client __meteor_runtime_config__ has the following value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmasncF00XFB1Tm5z497Yw.png" /><figcaption>__meteor_runtime_config__’s value on mobile platform.</figcaption></figure><p>As shown above, there is no property named VUE_DEV_SERVER_URL in this object. Therefore, <em>undefined</em> is being assigned to the devServer variable, which is the cause of our problem.</p><p>Since the mobile client has ROOT_URL set, we could use this to get HMR URL by adding 3 to its port, which will be http://&lt;IPv4 of your computer&gt;:3000. The following fix uses the ROOT_URL to derive the HMR URL.</p><h4>Finally, the fix.</h4><p>Add a folder named packages in your meteor app’s root folder and download the atmosphere package <a href="https://github.com/meteor-vue/vue-meteor/tree/master/packages/vue-component-dev-client/client"><strong><em>akryum:vue-component-dev-client</em></strong></a> and modify vue-component-dev-client/client/dev-client.js as shown below,</p><p>Add these 5 lines before devUrl is initialized inside Meteor.startup callback</p><pre><em>if</em>(Meteor.isCordova){</pre><pre>const root = new URL(__meteor_runtime_config__.ROOT_URL)</pre><pre>__meteor_runtime_config__.VUE_DEV_SERVER_URL    = root.protocol+&#39;//&#39;+root.hostname+&#39;:&#39;+(parseInt(root.port)+3)+&#39;/&#39;;</pre><pre>}</pre><p>Don’t forget to import <a href="https://www.npmjs.com/package/url"><strong><em>url</em></strong></a> after all the imports at the beginning of the file.</p><pre>const url = require(&#39;url&#39;);</pre><p><em>I know this is a naive fix but, until this issue is patched by akryum or Cordova this works for the time being.</em></p><p>I created a pull request for the official repo. Check it out <a href="https://github.com/meteor-vue/vue-meteor/pull/422"><strong><em>here</em></strong></a>.</p><p>Also read —</p><p><a href="https://medium.com/fasal-engineering/deconstructing-pwa-a-detailed-guide-to-googles-bet-for-the-future-of-web-applications-f9af822994ef">Deconstructing PWA — A detailed guide to Google’s bet for the future of Web Applications</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93e2ee613e69" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fasal-engineering/workaround-for-hmr-dev-server-url-undefined-when-working-with-meteor-vue-and-cordova-93e2ee613e69">How to resolve the Hot Module Replacement issue while testing your Vue-Meteor App on Actual Device</a> was originally published in <a href="https://medium.com/fasal-engineering">Fasal Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>