Tag Archives: mui

Uncaught SyntaxError: Unexpected end of JSON input [How to Solve]

#Error description

The following error occurred while debugging the program:

This is a dynamically generated list. When clicking the list to migrate to the display content screen, the screen cannot be displayed normally and an error is reported. However, it is worth noting that not all lists have problems during migration, but only one has problems.

# findings

The number of JSON string fields exceeds the maximum limit. The final solution is to decompose the fields into two fields (in fact, it is equivalent to surrender). It seems that it may be the problem of string conversion from the background server (PHP) to JSON.

In short, after reducing the string length of the field, the problem can be solved temporarily.

# investigation means

Deleting part of the data and finally being confirmed is the problem of the data range, rather than the problem of individual characters guessed before the investigation.

Mui Error:Unable to preventDefault inside passive event listener due to target being treated as pas…

problem description : when you click the return button, the following errors appear in the console each time:

mui.min.js:13 Unable to preventDefault inside passive event listener due to target being treated as passive.

solutions :

Locate the error line of mui.min.js, and find that the error code is a.preventdefault(), so comment out a.preventdefault() in mui.min.js, and the problem is solved

problem analysis :

What functions does the preventdefault() function implement?Is there any impact on the specific function of annotation

The preventdefault () method prevents elements from default behavior (for example, preventing the submission of forms when the submit button is clicked). For example, you can use event. Preventdefault() to prevent tag a from jumping

Because the browser can’t know in advance whether an event handler will call preventdefault (), it needs to wait until the event handler is executed before it can execute the default behavior. However, the execution of the event handler is time-consuming, which will cause the page to jam. That is to say, when the browser waits for the default behavior of the event to be executed, Most of the time it’s just waiting for nothing

If the web developer can tell the browser in advance that “ I don’t call the preventdefault function to prevent the event behavior “, then the browser can quickly generate events and improve the page performance. The proposal of passive event listeners solves this problem

In my project, I successfully solved the problem of console error reporting by commenting out preventdefault(), and I haven’t found any effect on other functions yet