Skip to content

pollingInterval broken #3224

Answered by markerikson
mauriceoc asked this question in Q&A
Mar 1, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

@mauriceoc : this sounds like expected behavior to me.

By default, making an API call via fetch or XHR and then parsing the JSON response will result in new object references being created, even if the contents of the response is conceptually the same.

In other words:

const jsonString = '{"a": 1}';
const obj1 = JSON.parse(jsonString);
const obj2 = JSON.parse(jsonString);
console.log(obj1 === obj2) // FALSE, they are two different objects in memory

However, if you have a query that keeps fetching the "same" data, this would create a problem. If we always replaced the existing data entirely, then your component would always re-render every time the polling request came back due to the new r…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mauriceoc
Comment options

@markerikson
Comment options

@mauriceoc
Comment options

Answer selected by mauriceoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants