Favoriting contacts doesn't work #123

Closed
opened 2026-10-05 01:58:18 +02:00 by adam · 8 comments
Owner

Clicking the star icon causes it to blink yellow for a second and then go back to unset. The contact in the left-hand bar briefly jumps up to the favorites block (which is now empty).

HTTP request to toggle:

{"type":"contact","id":"ac30beafa502f4b027a49a885285490e39a20917f3182c7e0c779f3a5ad03800"}

HTTP response data:

{
    "type": "contact",
    "id": "df5a4df768b3eb36981e14e6cb57dab4ab26965e81fa54443158ab233ca9878f",
    "favorite": true
}

Version: 3.9.0 01c86a4 (latest git)

Device: Heltec V3 running 20-Mar-2026/v1.14.1-467959c (max: 350 contacts, 40 channels), connected via USB serial

Clicking the star icon causes it to blink yellow for a second and then go back to unset. The contact in the left-hand bar briefly jumps up to the favorites block (which is now empty). HTTP request to `toggle`: ``` {"type":"contact","id":"ac30beafa502f4b027a49a885285490e39a20917f3182c7e0c779f3a5ad03800"} ``` HTTP response data: ``` { "type": "contact", "id": "df5a4df768b3eb36981e14e6cb57dab4ab26965e81fa54443158ab233ca9878f", "favorite": true } ``` Version: 3.9.0 01c86a4 (latest git) Device: Heltec V3 running 20-Mar-2026/v1.14.1-467959c (max: 350 contacts, 40 channels), connected via USB serial <!-- github-sync-id:4227900866 -->
adam closed this issue 2026-10-05 01:58:19 +02:00
Author
Owner

Hmm interesting. So you get a response confirming it being favorites and then it immediately is removed? And doesn't show up on refresh? Any errors in the console?

Hmm interesting. So you get a response confirming it being favorites and then it immediately is removed? And doesn't show up on refresh? Any errors in the console? <!-- github-comment-id:4210006290 -->
Author
Owner

Oh just spotted the difference in key. Weird; looking into it.

Oh just spotted the difference in key. Weird; looking into it. <!-- github-comment-id:4210007102 -->
Author
Owner

Are you seeing a request for one ID and a response for another ID consistently, or only for one contact? I'm not able to replicate and having that mismatch would be SUPER weird since this is an atomic DB operation; it should only be possible for it to spit the same ID back at you as you fed it. The only plausible thing I could think of would be a race condition when that client adverts and you favorite it, but even then that should be a one in a million timing coincidence.

Are you seeing a request for one ID and a response for another ID consistently, or only for one contact? I'm not able to replicate and having that mismatch would be SUPER weird since this is an atomic DB operation; it should only be possible for it to spit the same ID back at you as you fed it. The only plausible thing I could think of would be a race condition when that client adverts and you favorite it, but even then that should be a one in a million timing coincidence. <!-- github-comment-id:4210018712 -->
Author
Owner

Hmm, the key mismatch might be my bad -- I might have copied it from the wrong toggle invocation.

The keys do match. No errors in the console. Here's the server log:

2026-04-08 15:15:47 - app.routers.settings - INFO - Added contact favorite: ac3a0050a588
2026-04-08 15:15:47 - uvicorn.access - INFO - 192.168.64.2:56910 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK
2026-04-08 15:15:55 - app.routers.settings - INFO - Removed contact favorite: ac3a0050a588
2026-04-08 15:15:55 - uvicorn.access - INFO - 192.168.64.2:38996 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK
2026-04-08 15:15:56 - app.routers.settings - INFO - Added contact favorite: ac3a0050a588
2026-04-08 15:15:56 - uvicorn.access - INFO - 192.168.64.2:39004 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK

and the responses toggle back and forth:

{
    "type": "contact",
    "id": "ac3a0050a58823ee416889216db344be6580fe1530498f3da75e6fb419501f72",
    "favorite": false
}
{
    "type": "contact",
    "id": "ac3a0050a58823ee416889216db344be6580fe1530498f3da75e6fb419501f72",
    "favorite": true
}

so it seems it's purely a frontend thing.

Image

Hmm, the key mismatch might be my bad -- I might have copied it from the wrong `toggle` invocation. The keys do match. No errors in the console. Here's the server log: ``` 2026-04-08 15:15:47 - app.routers.settings - INFO - Added contact favorite: ac3a0050a588 2026-04-08 15:15:47 - uvicorn.access - INFO - 192.168.64.2:56910 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK 2026-04-08 15:15:55 - app.routers.settings - INFO - Removed contact favorite: ac3a0050a588 2026-04-08 15:15:55 - uvicorn.access - INFO - 192.168.64.2:38996 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK 2026-04-08 15:15:56 - app.routers.settings - INFO - Added contact favorite: ac3a0050a588 2026-04-08 15:15:56 - uvicorn.access - INFO - 192.168.64.2:39004 - "POST /api/settings/favorites/toggle HTTP/1.1" 200 OK ``` and the responses toggle back and forth: ``` { "type": "contact", "id": "ac3a0050a58823ee416889216db344be6580fe1530498f3da75e6fb419501f72", "favorite": false } ``` ``` { "type": "contact", "id": "ac3a0050a58823ee416889216db344be6580fe1530498f3da75e6fb419501f72", "favorite": true } ``` so it seems it's purely a frontend thing. ![Image](https://github.com/user-attachments/assets/ce507e7f-0c88-4333-b308-caaccb290942) <!-- github-comment-id:4210073301 -->
Author
Owner

Hmmmm very interesting. Glad at least it's not an ID match. I know it's so dumb but I have to ask -- you're single clicking and not double clicking, right? No double click macros wired to your mouse? I'll wire up some debug lines and push them for you to pull down for testing once I'm back at my desk

Hmmmm very interesting. Glad at least it's not an ID match. I know it's so dumb but I have to ask -- you're single clicking and not double clicking, right? No double click macros wired to your mouse? I'll wire up some debug lines and push them for you to pull down for testing once I'm back at my desk <!-- github-comment-id:4210157156 -->
Author
Owner

Yes, single clicking only.

Reproducible in both Safari and Chrome.

Oh, notably: favoriting channels doesn't work either.

Yes, single clicking only. Reproducible in both Safari and Chrome. Oh, notably: favoriting channels doesn't work either. <!-- github-comment-id:4210215551 -->
Author
Owner

Okay I've pushed up some commits to main that should deal with a false positive (but still not good) race condition that is not what you're facing, and now we should have some richer debug lines in the browser console.

Give it another shot on latest main (don't forget to rebuild frontend) and lemme know how it goes. You should see something in your browser console like this:

Image

How are you running your frontend? npm run build? npm run dev? prebuilt frontend fetch? docker image?

Okay I've pushed up some commits to main that should deal with a false positive (but still not good) race condition that is not what you're facing, and now we should have some richer debug lines in the browser console. Give it another shot on latest main (don't forget to rebuild frontend) and lemme know how it goes. You should see something in your browser console like this: <img width="749" height="175" alt="Image" src="https://github.com/user-attachments/assets/c5b69882-db69-4b73-b402-43374bcf8938" /> How are you running your frontend? npm run build? npm run dev? prebuilt frontend fetch? docker image? <!-- github-comment-id:4210333870 -->
Author
Owner

don't forget to rebuild frontend

Ah, that solved my problem. I was pulling the latest git, including your recent favorites changes, and simply restarting without doing that.

Works now.

> don't forget to rebuild frontend Ah, that solved my problem. I was pulling the latest git, including your recent favorites changes, and simply restarting without doing that. Works now. <!-- github-comment-id:4210392363 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Remote-Terminal-for-MeshCore#123