Javascript error, when editing title of topic

AI-generated summary

A Javascript error occurs when editing the title of a topic and saving without making any changes. The error is reported in the browser console with the message “Cannot read property ‘categoryId’ of null.”

dirien initially reported the issue and found a workaround by re-selecting the same category. The error was reproduced by dirien and codinghorror on the Discourse site.

The issue was identified as a bug and CvX fixed it in the following pull request: https://github.com/discourse/discourse/pull/13227.

Version: 2.8.0beta1

Hi,

When i edit the title of a topic and press to save this changes i get following error message in the console of my browser:

And i can not save.

Workaround: When i select in the category the same category again it works fine.

stacktrace as code
_application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:14124 Uncaught TypeError: Cannot read property 'categoryId' of null
    at Function.update (_application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:14124)
    at t.finishedEditingTopic (_application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:43889)
    at e.t._join (_ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:67257)
    at e.t.join (_ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:66968)
    at c (_ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:53760)
    at _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:20968
    at r (_ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:50091)
    at _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:20967
    at t.click (_application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:53754)
    at trigger (_ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:46074)
update @ _application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:14124
finishedEditingTopic @ _application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:43889
t._join @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:67257
t.join @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:66968
c @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:53760
(anonymous) @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:20968
r @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:50091
(anonymous) @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:20967
click @ _application-86788722cd8f3df1744e65d28cfd87674427a5a7333088bffef2b649f20114be.js:53754
trigger @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:46074
e @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:43433
t._run @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:67275
t._join @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:67251
t.join @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:66968
c @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:53760
(anonymous) @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:46175
r @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:50091
handleEvent @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:46171
handleEvent @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:45108
(anonymous) @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:45498
dispatch @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:5443
d.handle @ _ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.js:5247

Looking forward for your feedback.

4 Likes

Unless you can reproduce it here (try changing the category on this topic, your own topic, from bug to something else) it is not a bug, but an issue in configuration on your site.

Same issue here:

@codinghorror : Sorry not so much in the definition of bug in the discourse domain. For me it looked like a bug, as i did not changed anything on our site. But i can reporduce it here too, which still not mean its a bug..

2 Likes

I can reproduce it here:

Chrome: Version 89.0.4389.90 (Offizieller Build) (x86_64)

  1. Refresh page
  2. Click on edit title
  3. Press Save (without any changes)
  4. Javascript error message.

@codinghorror : Okay to move it back to bug?

Ok so the error is when you initiate a title edit on the first post, but you don’t actually change anything, and press save? Let me test that… editing soon..

aha yes I can repro this. Thanks for the report, indeed a bug of some kind @zogstrip . When you edit the topic title / category via the edit button next to the topic title, but don’t make any changes, and then press save, it is as @dirien describes.

3 Likes

@cvx can you add this to your list?

5 Likes

Fixed in:

https://github.com/discourse/discourse/pull/13227

Thanks for the report! :smiley:

4 Likes