What is the impact of time-consuming computations on the performance of Vue server-side rendering?

Currently, I am in the process of developing a website for a major company that specializes in selling various goods. The website boasts an extensive catalogue with numerous search options and filters, which unfortunately take some time to compute and render (about 1-2 seconds). Despite my efforts, I am unable to speed up this process any further as each filter needs to be meticulously checked in order to provide accurate results.

Whenever I click on a checkbox to apply a filter, the website freezes (according to the Performance tab in Chrome Dev Tools, the JS engine is highly occupied). This concerns me because users may get impatient and repeatedly click on filters while the system is still processing, resulting in frustration when no filter is actually applied. I attempted to use a new Promise to wrap the time-consuming operations, but it did not improve the responsiveness and continued to freeze the browser.

Therefore, I have two questions:

  • Is there a way to prevent user input while Vue is computing the results (perhaps display a "loading" screen)? My attempts to do so by including specific instructions at the beginning of the method/computed and before the function body were unsuccessful.
  • If I were to implement server-side rendering with Vue, how would it impact the situation? Would it still freeze for a second while waiting for server response, or would it behave more like a Promise function?

I hope I have effectively articulated the issue. If there are any details that I have overlooked, please let me know so that I can address them accordingly.

Answer №1

To enhance the performance of this code, I recommend transferring the intricate logic to a client-side worker script responsible for handling requests and filtering. Moreover, from a user interface perspective, incorporating a "Working..." overlay with a visually appealing animation can provide users with feedback indicating ongoing processes.

Regarding server-side operations... If server-side rendering using Node is employed for complex blocking computations, it may negatively impact all users unless a worker pool or RPC fronting worker queue is implemented. While feasible, the implementation involves more advanced solutions that are outside the scope of discussion on this platform.

In conclusion, utilizing a worker script along with an animation feature seems to be the optimal approach in this scenario.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trouble with implementing an onclick event listener in a foreach loop

While generating and adding HTML in a for loop, I noticed that adding onclick events within the same loop is not functioning correctly: items.forEach(item => { itemHtml = `<div class="${item.id}">${item.id}</div>`; $(".it ...

Certain conditions in JavaScript are not executed by Internet Explorer

I am currently working on a Html file that involves XSLT. I have integrated some JavaScript code for filtering specific rows within tables. However, I have encountered an issue where certain if-cases in my JavaScript are not executing as expected when usin ...

"Creating Interactive Slider Bullets: A Guide to Linking them to Their Respective

I can't seem to figure out how to connect my slider bullets to my slider slides. I want bullet 1 to correspond to slide 1, bullet 2 to slide 2, and so on. It should be a simple task, but I'm struggling to make it work. I have set up a basic reset ...

The for loop does not cycle through every element

I'm working on a class project that involves creating custom HTML tags with JavaScript. I have a for loop set up to iterate over each use of the tag, but for some reason, it only seems to loop over every other tag. I'm specifically trying to crea ...

What is a more efficient way to search and substitute text in NodeJS?

I am currently working on a task that involves reading a file, passing its contents and multiple arrays to a function, using regex to see if there are any matches, replacing them, and finally updating the file. The code I have put together may not be the ...

What are the steps to obtain the beginning and ending dates and times using a range picker?

I am having trouble figuring out how to extract the start and end from a date and time range picker that I typically use data-link-field="dtp_input1" to fetch the data to insert into a table as shown in this code snippet: <input type="hidden" id="dtp_i ...

JQuery click function not triggering the event

Here is the situation I am dealing with. On my index.php page, I have included the following JQuery code: jQuery(document).ready(function(){ jQuery('#sIMG img').click(function() { var currentSRC = jQuery(this).attr('src'); ...

How can you apply filtering to a table using jQuery or AngularJS?

I am looking to implement a filtering system for my table. The table structure is as follows: name | date | agencyID test 2016-03-17 91282774 test 2016-03-18 27496321 My goal is to have a dropdown menu containing all the &apo ...

Mastering the Art of Utilizing Emit and Props in the Nuxt3 Composition Api

I'm trying to implement emit and props in Nuxtjs3, but it seems like something is off. In my project, I have the need to access airport data across multiple pages, so I created an airportsearch component. This component is located inside components/ ...

Is there a way to retrieve values from two input fields using the onclick function?

In a div, I have added two input fields and an update button. Here's the code structure: <button type = "button" id = "add-botton" >Add Element </button> <div id = "trace-div1" class = "trace"> <h4><span>Trace 1& ...

Creating a border around a div element using JavaScript

Is there a way to set a border for a div box using JavaScript similar to using border:2px solid #000; in CSS? Can this be done within the following for loop? elements = document.getElementsByClassName("box"); for (var i = 0; i < elements.length; i++) ...

JavaScript encountered an issue: Uncaught ReferenceError - 'userNumber' is undefined at line 43

I'm currently working on a JavaScript guessing game where I've already set up the necessary functions. However, I keep encountering an error. An error in my JavaScript code is causing a ReferenceError: userNumber is not defined on line 43 to b ...

How can you stop data URI from being cached as an image source?

I am facing an issue where I have an img-tag with a data-image base64 URI as the source. Browsers tend to cache this source, which is causing problems for me. If it were a normal URL, I could easily prevent caching by adding a random query-parameter value. ...

The HTML element <p> is not spilling over onto a new line

Having trouble with text overflow in a kanban board? I've tried various CSS styling options like overflow-wrap: break-word;, word-wrap: break-word;, and hyphens: auto;, but nothing seems to work. Here's a preview. I'm using Vue.js, but I do ...

What is the best method for pulling in a static, plaintext JSON file into JavaScript through a GET request?

Currently, I am running a test with this specific link: accessing static json data I have encountered several issues with cross-site request errors. It is puzzling to me why it should be any different from loading an image that is hosted on the same site ...

Adjust the size of the wrapper/mask as the browser is resized

Is there a way to adjust the size of my wrapper and mask when the browser is resized? Currently, the mask stops once it's loaded, causing the content to be cut off when scrolling. You can view an example on this site. $(document).ready(function() { ...

Loading custom places in ArcGIS from a file or database

Hey there, I was wondering about loading custom places with Arcgis similar to Google maps loading from a .xml file. I noticed that Arcgis uses examples saved in .json format, but when I tried putting the example .json on my local server it wouldn't lo ...

Obtaining zip files using AngularJS

Upon entering the following URL in my browser, I am prompted to download a file: My goal is to download this file using an AngularJS HTTP request. I have created a factory for this purpose, but unfortunately, the download is not successful. Even though ...

Seeking a light-weight, text-rich editor specifically designed for use on our enterprise website. This editor should be even lighter than TinyMCE

I am in search of a lightweight text editor for an enterprise website, lighter than tinymce with basic buttons for the comment form. It is imperative that the editor also functions properly in IE6. So far, I have tried cleditor 15KB, but it has an issue in ...

Is it possible to employ JavaScript for performing a Ctrl-F5 refresh?

I'm working with a small asp file that runs in a frame. Is there a way to trigger a CTRL+F5 type of refresh to reload the entire browser window? I've attempted using parent.location.reload(true), location.reload(), and various other methods, but ...