Athou / commafeed

Google Reader inspired self-hosted personal RSS reader.
https://www.commafeed.com
Apache License 2.0
2.82k stars 377 forks source link

Editing feed throws error #1076

Closed ScuttleSE closed 1 year ago

ScuttleSE commented 1 year ago

Describe the bug When trying to edit feeds I get an error telling me "Cannot read properties of null (reading 'toFixed')"

To Reproduce Steps to reproduce the behavior:

  1. Click on the edit-icon to the right of the feed-name when you have a feed open
    1. See error

Expected behavior For the details about the feed to appear

Screenshots If applicable, add screenshots to help explain your problem. image

Environment (please complete the following information):

Additional context Not every feed gives me this error, about 60% of my feeds throws this error.

Athou commented 1 year ago

I'm not able to reproduce, could you try to make the error happen again but with the Dev Tools opened (F12) on the console tab, and take a screenshot of the error with the stacktrace to help me understand where the error is coming from please?

ScuttleSE commented 1 year ago

Sure!

image

mantine-db0219e2.js:79 TypeError: Cannot read properties of null (reading 'toFixed')
    at te (mantine-db0219e2.js:79:296636)
    at X (mantine-db0219e2.js:79:296885)
    at mr (mantine-db0219e2.js:79:297057)
    at mantine-db0219e2.js:79:297493
    at Rf (mantine-db0219e2.js:79:24263)
    at Go (mantine-db0219e2.js:79:42315)
    at mantine-db0219e2.js:79:40658
    at $ (mantine-db0219e2.js:64:1540)
    at MessagePort.z (mantine-db0219e2.js:64:1902)
Up @ mantine-db0219e2.js:79
V$.a.componentDidCatch.t.callback @ mantine-db0219e2.js:79
Qy @ mantine-db0219e2.js:77
fh @ mantine-db0219e2.js:79
eS @ mantine-db0219e2.js:79
XT @ mantine-db0219e2.js:79
r4 @ mantine-db0219e2.js:79
Bn @ mantine-db0219e2.js:79
mh @ mantine-db0219e2.js:79
In @ mantine-db0219e2.js:77
Go @ mantine-db0219e2.js:79
(anonymous) @ mantine-db0219e2.js:79
$ @ mantine-db0219e2.js:64
z @ mantine-db0219e2.js:64
Athou commented 1 year ago

Thanks! Do you mind sharing the JSON response of the GET request for the feed details too please? It's in the Network tab, it should the last line (request to rest/feed/get/[id]

ScuttleSE commented 1 year ago

Sure thing. First is the request, I did a "copy all as fetch" (real domain replaced with example.org)

fetch("https://rss.example.org/rest/feed/get/68", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "accept-language": "en-US,en;q=0.9,sv-SE;q=0.8,sv;q=0.7",
    "sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Linux\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin"
  },
  "referrer": "https://rss.example.org/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "include"
});

And here is the json response

{
    "id": 68,
    "name": "SweClockers.com",
    "message": "content hash not modified",
    "errorCount": 0,
    "lastRefresh": 1686810213000,
    "nextRefresh": 1686810513000,
    "feedUrl": "http://www.sweclockers.com/feeds/nyheter",
    "feedLink": "https://www.sweclockers.com",
    "iconUrl": "rest/feed/favicon/68",
    "unread": 466,
    "categoryId": "4",
    "position": null,
    "newestItemTime": 1686802843000,
    "filter": null
}
ScuttleSE commented 1 year ago

Here is the JSON from one of the feeds that I can edit

{
    "id": 8001,
    "name": "LTT Floatplane Posts",
    "message": "content hash not modified",
    "errorCount": 0,
    "lastRefresh": 1686816172000,
    "nextRefresh": 1686816472000,
    "feedUrl": "https://cronjobs.hemma.lokal/ltt.rss",
    "feedLink": "https://www.floatplane.com/channel/linustechtips/home",
    "iconUrl": "rest/feed/favicon/8001",
    "unread": 3,
    "categoryId": "6",
    "position": 0,
    "newestItemTime": 1686792480000,
    "filter": null
}
Athou commented 1 year ago

Thanks, that helps a lot. Can you confirm that feeds that you cannot edit all have a null position (and not a numeric one)?

ScuttleSE commented 1 year ago

They do indeed seem to match

MariaDB [cf]> select id,position from feedsubscriptions;
+---------+----------+
| id      | position |
+---------+----------+
|       1 |     NULL |
|      10 |       11 |
|      15 |     NULL |
|      16 |     NULL |
|      23 |     NULL |
|      25 |     NULL |
|      26 |     NULL |
|      28 |     NULL |
|      33 |        7 |
|      34 |        8 |
|      35 |        9 |
|      37 |       10 |
|      40 |       12 |
|      43 |       13 |
|      47 |       14 |
|      51 |       15 |
|      52 |     NULL |
|      53 |     NULL |
|      56 |     NULL |
|      59 |     NULL |
|      60 |     NULL |
|      66 |     NULL |
|      68 |     NULL |
|    2001 |        7 |
|    2004 |        0 |
|    2005 |        5 |
|    3001 |        3 |
|    4000 |        0 |
|    4001 |        0 |
|    4003 |        0 |
|    5001 |        0 |
|    5002 |        0 |
|    5003 |        0 |
|    6000 |        0 |
|    7000 |        0 |
|    7001 |        0 |
|    8001 |        0 |
|    9000 |        0 |
|   11000 |        0 |
| 3012000 |        0 |
| 3016001 |        9 |
| 3017000 |        0 |
| 3018003 |        2 |
| 3021000 |        1 |
| 3021002 |        4 |
| 3022002 |        0 |
+---------+----------+

I tried updating from NULL to 0 on one of the feeds, that seemed to do the trick

MariaDB [cf]> update feedsubscriptions set position = 0 where id = 1;

Should I just set all the NULLs to 0?

Athou commented 1 year ago

Should I just set all the NULLs to 0?

That should help you right now, yes. I'll make a change so that position is never NULL.

ScuttleSE commented 1 year ago

That seemed to do the trick. The same error appeared with the feed categories, and setting feedcategories.position to 0 instead of NULL fixed that too.