The Vue warning message states: "An error occurred during rendering: TypeError - Unable to access the 'Id' property of an undefined or null reference."

After testing it with various browsers such as Chrome, Firefox, Opera, and Internet Explorer, I noticed that the error only occurs in Firefox.

In my Vue.js code, I have two computed properties that change almost simultaneously. When I modify my select box, both properties are triggered because this.gekozenWinding changes when a different option is selected in the box.

Below is the code for both properties:

kant() {
  if (this.gekozenWinding != null) {
    var id = this.haalID(this.windings, this.gekozenWinding);
    parseInt(id);
    if (id < 5 && id > 0) return true;
    else {
      return false;
    }
  }
},
graden() {
  if (this.gekozenWinding != null) {
    var id = this.haalID(this.windings, this.gekozenWinding);
    switch (id) {
      case "1":
        return "180"; break;
      case "2":
        return "0"; break;
      case "3":
        return "270"; break;
      case "4":
        return "90"; break;
      case "5":
        return "180"; break;
      case "6":
        return "0"; break;
      case "7":
        return "270"; break;
      case "8":
        return "90"; break;
    }
  } else {
    return "0";
  }
}

My method haalID():

    haalID(lijst, item) {
  /*
  1.Filters out given item(string) from a lijst(array).
  2.Gets the ID from the filtered object.
  3. returns the ID
  */
  var id = lijst.filter(i => i.Descriptions[0].Description == item);
  id = id[0].Id;
  return id;
}

This is inside my template:

          <div class="row">
        <div class="form-group col-9">
          <label>Winding</label>
          <select
            class="form-control"
            v-model="gekozenWinding"
          >
            <option
              v-for="winding in windings"
              v-bind:key="winding.Id"
            >{{winding.Descriptions[0].Description}}</option>
          </select>
        </div>
      </div>
      <div v-if="gekozenWinding != null && gekozenWinding != 'To determine'">
        <div class="parent1" v-if="kant ">
          <img id="fto1" src="../assets/buitenkant.png" alt>
          <img
            id="fto2"
            v-bind:style="{'transform': `rotate(${graden}deg)`}"
            src="../assets/A.png"
            alt
          >
        </div>
        <div class="parent2" v-else>
          <img id="fto3" src="../assets/Binnenkant.png" alt>
          <img
            id="fto4"
            v-bind:style="{'transform': `rotate(${graden}deg)`}"
            src="../assets/A.png"
            alt
          >
        </div>
      </div>

The issue only arises in Internet Explorer version 11, while other browsers work perfectly fine. I've made multiple attempts to modify the code but can't seem to get it to function correctly in IE.

Answer №1

Unfortunately, IE11 (and all versions of Internet Explorer) do not support arrow functions.

To check for browser compatibility when using arrow functions, you can visit caniuse.com/#search=arrow%20functions.

If you need to use arrow functions in your code, consider using a compiler like Babel, or find alternative solutions that do not rely on arrow functions.

var result = list.filter(function (item) {
  return item.Descriptions[0].Description == value;
});

Answer №2

It is possible that the error lies within the template. Have you checked if your windings have an Id?

Try replacing key with $index in the v-for loop for options.

<option v-for="(winding, $index) in windings"
    v-bind:key="$index">
{{winding.Descriptions[0].Description}}</option>

PS: It's odd that this error is not showing up in other browsers..

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

How can I retrieve the ultimate value of a JQuery UI Slider and store it in a PHP variable?

I am looking to add 2 JQ UI Sliders to a single page on my PHP website. I need to capture the final values from both sliders (the last value when the user stops sliding) and store them in PHP variables for multiplication. How can I accomplish this task? I ...

The token endpoint in Nuxtjs auth module's configuration for auth strategies is not being triggered

Our system has two important endpoints, namely /auth and /token. The endpoint /auth is responsible for providing the authorization code required to call /token in order to obtain an access token. The utilization of NuxtJS has made the auth module a prefer ...

No need for jQuery with this scrolling image gallery

I recently created a horizontal scrolling image gallery with thumbnails underneath. The goal is to click on a thumbnail and have the corresponding image scroll into view. Here's the HTML setup: <div class="images_container"> <img id="imag ...

The request's body in the PUT method is void

I seem to be having an issue with my PUT request. While all my other requests are functioning properly, the req.body appears to remain empty, causing this error message to occur: errmsg: "'$set' is empty. You must specify a field like so: ...

typescript throwing an unexpected import/export token error

I'm currently exploring TypeScript for the first time and I find myself puzzled by the import/export mechanisms that differ from what I'm used to with ES6. Here is an interface I'm attempting to export in a file named transformedRowInterfac ...

Error encountered on page load due to undefined variable thrown by the Express-validator validation process

In the process of constructing a contact form and incorporating express-validator for validation, I am currently focused on error handling. Below is a snippet of the code from my app.js file that pertains to this matter: // CREATE (POST) ROUTE - add new p ...

Iterate through a jQuery function to retrieve values from checkboxes starting from the 4th one that has been clicked

I am currently using a loop in a form to calculate the total price of a product based on user selections. However, I have encountered a challenging task where certain checkbox groups have specific rules. For instance, group A should only contribute to the ...

Utilize the functions.php script in the footer, rather than in the head section

Encountered an issue in my JS file where a hover event listener was causing a 'Cannot read property 'addEventListener' of null' error. The code snippet I used for the listener came from W3 schools and targeted elements with the class "c ...

Firebase Hosting integrated with Cloud Functions

Struggling with deploying my functions and hosting. While I have managed to get them working separately on different branches, integrating both hosting and cloud functions is proving to be a challenge. It seems like my cloud function is not deploying succ ...

Search through an array, identify duplicates, and transfer them into a separate array

I am working with an array of objects containing dates and I am looking to extract objects with the same date values into a new array. Below is the code snippet. var posts = [ { "userid": 1, "rating": 4, "mood": "happy", "date": "2 ...

CSS: Problem Arising from Line Connections Between Tree Elements

I'm currently working on connecting tree nodes with lines in a drawing. I've managed to achieve it to some extent, but there are a few issues like dangling lines that I need to fix. You can find the implementation on codepen here: https://codepe ...

Angular JS is experiencing issues with two modules not functioning properly on a single page

Angular JS is a new technology for me. I have two modules, first2a and first22. Each module contains a controller named model1 and model2. Here is the HTML code: <!DOCTYPE html> <html > <head> <link rel="icon" ...

Tips for verifying the contents of a textbox with the help of a Bootstrap

I am still learning javascript and I want to make a banner appear if the textbox is empty, but it's not working. How can I use bootstrap banners to create an alert? <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&g ...

Is there a way to create a blurred background effect while the popup is in use?

I prefer my popup to have a dark or blurred background when active. The popup itself should remain the same, with only the background being darkened. I would like a dark layer overlaying the entire page. This script should be compatible with any website wh ...

What is the process for showing and hiding text when a div is clicked?

Hey, I'm completely new to web development and decided to practice some of the concepts I've been learning about. I created a simple program that toggles between day and night. Clicking on the sun reveals the moon, and clicking on the moon revea ...

My Vuejs project is becoming overwhelming due to the excessive number of watchers, making it difficult to scale the code

Looking for a way to streamline and scale down this code: (including snippets for illustration purposes) hoodiesml: false, hoodiemed: false, hoodielrg: false, hoodiexlrg: false, hoodiexxlrg: false, hoodiesmlqty: 0, hoodiemedqt ...

I discovered an issue in Handsontable while trying to copy and paste a numeric value in German format

For my upcoming project, I am looking to incorporate the Handsontable JavaScript grid framework. However, I have encountered a small bug that is hindering me from utilizing this library to its fullest potential. The task at hand involves displaying a tabl ...

Adding a class to a clicked button in Vue.js

A unique function of the code below is showcasing various products by brand. When a user clicks on a brand's button, it will display the corresponding products. This feature works seamlessly; however, I have implemented a filter on the brands' lo ...

Developing a Chrome browser extension tailored for parsing unique file formats

Currently, I am working on developing a compiler for a unique conditional formatting language. My aim is to enable the capability of opening files in my language directly in Chrome by simply double-clicking on them in File Explorer (I am currently using Wi ...

React 15 is found to be incompatible with React-redux due to certain compatibility

I'm currently working on upgrading to the newest version of [email protected] in my project, which also utilizes the react-redux@^4.4.0 package. However, I encountered issues when attempting to follow the upgrade instructions provided in the documenta ...