Skip to main content
update wording
Source Link

I haven’t tested this code but my guesspresumption is that the call to .populate('category') comes after the callback where res.render() is called - so that may be a bug.

I haven’t tested this code but my guess is that the call to .populate('category') comes after the callback where res.render() is called - so that may be a bug.

I haven’t tested this code but my presumption is that the call to .populate('category') comes after the callback where res.render() is called - so that may be a bug.

Bounty Ended with 50 reputation awarded by Razvan Zamfir
added 106 characters in body
Source Link

The answer by CertainPerformance to your previous post recommends avoiding the var keyword. Yet this code uses it:

That variable is never reassigned so it can be declared with const. And similarly for updateCategory() - it has a variable declared with var named form that never gets re-assigned.

The answer by CertainPerformance recommends avoiding the var keyword. Yet this code uses it:

That variable is never reassigned so it can be declared with const. And similarly for updateCategory.

The answer by CertainPerformance to your previous post recommends avoiding the var keyword. Yet this code uses it:

That variable is never reassigned so it can be declared with const. And similarly for updateCategory() - it has a variable declared with var named form that never gets re-assigned.

added 345 characters in body
Source Link

With async / await the code that is typically in the promise callback can be moved out- so instead oftake this section for example:

I haven’t tested this code but my guess is that the call to .populate('category') comes after the callback where res.render() is called - so that may be a bug.

It can be like simplified to something like this:

Though maybe the call to populate the category needs to come after the value from Post.find({}) Is assigned to posts.

With async / await the code that is typically in the promise callback can be moved out- so instead of

It can be like this:

With async / await the code that is typically in the promise callback can be moved out- so take this section for example:

I haven’t tested this code but my guess is that the call to .populate('category') comes after the callback where res.render() is called - so that may be a bug.

It can be like simplified to something like this:

Though maybe the call to populate the category needs to come after the value from Post.find({}) Is assigned to posts.

Source Link
Loading