Skip to content

Commit

Permalink
add comment for reasoning behind change
Browse files Browse the repository at this point in the history
  • Loading branch information
cstavitsky committed Nov 28, 2023
1 parent af74049 commit bd76583
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions react/src/components/Products.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ function Products({ frontendSlowdown, backend }) {
}
}

/*
Fetching and setting the products used to be done in an
async componentDidMount function. We have (Nov 2023) changed the way of
doing this to be non-async, because the async function was getting minified in the
relevant browser profiling frame, and this made it hard to showcase profiling.
Jonas B explained why switching away from async function helped:
"I think what you are seeing is unrelated to hooks and probably
related to the async keyword + babel transform, hence why it probably got
fixed with hooks (no transform on that class method anymore)"
*/
useEffect(() => {
// getProducts handles error responses differently, depending on the browser used
function getProducts(frontendSlowdown) {
Expand Down

0 comments on commit bd76583

Please sign in to comment.