#5312 - Forums: Adding a new topic results in either 404 not found or POST parameter id having invalid integer
This is a spacer post for a website comment topic. The content this topic relates to: #5312 - Forums: Adding a new topic results in either 404 not found or POST parameter id having invalid integer
By Guest
posted
Issue was cns_forum.js was not properly re-writing the action attribute on the form due to recent changes made as recommended by esLint (now that we are doing strict type comparisons, the undefined variable which was being compared to null was failing an if condition).
By Guest
posted
Additional note: This was a hard bug to spot as there were no JS calls on posting-form directly. I was able to locate the source by using the JavaScript mutationObserver on the form to monitor for changes to its attributes. And in the callback, I called console.error to produce a stack trace so I can locate what exactly was modifying the action attribute (and how).
By Guest
posted
Whoops. I shouldn't have actually done that change, as ESLint didn't require it, I was just flooded in little issues and it looked like one of those issues. We actually are allowing type week checks against null in our JS codebase, presumably for this kind of issue.
By Guest
posted
No worries. I simply just initialized the variable to null instead of undefined to fix the issue and keep type strict comparison in place. I can revert that and remove the type strict check if you wish.
By Guest
posted
Your change is good.
0 guests and 0 members have recently viewed this.

