home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.08k stars 2.79k forks source link

Logbook in "more info dialog" duplicates entries #17769

Open TheJulianJES opened 1 year ago

TheJulianJES commented 1 year ago

Checklist

Describe the issue you are experiencing

When a "more info dialog" with logbook entries is opened on iOS and the app (Safari or HA iOS app) then gets minimized for ~20 seconds, duplicate entries will show up if the app is re-opened.

Here's a video showing the issue (real-time):

https://github.com/home-assistant/frontend/assets/6409465/aca4bb46-7d67-47bf-999e-90c8aff38691

While I'm using the iOS Home Assistant companion app in the video, this also reproduces when just using Safari on iOS. The iOS version also doesn't seem to matter, since this already happened about a year ago or so. (Re-opening the more info dialog "removes" the duplicate entries again.)

I'm guessing the duplicate entries appear when the frontend "reconnects" and the list either isn't cleared when doing that, or doesn't check if the to-be-added entries are already present.

(This issue is present since quite some time already, I just finally got around to reporting it.)

Describe the behavior you expected

New entries should appear upon relaunching the Home Assistant iOS app (or Safari), but duplicate entries shouldn't appear.

Steps to reproduce the issue

  1. Open Home Assistant iOS app or Safari on iOS
  2. Open the more info dialog of an entity with a logbook below (for example, a binary sensor)
  3. See non-duplicated entries
  4. Minimize Home Assistant iOS app (by swiping to home)
  5. Wait ~30 seconds
  6. Open Home Assistant iOS app again
  7. Same more info dialog will still be opened, but now with duplicated logbook entries

(If it doesn't reproduce on first try, minimize the app again, wait a bit (longer), open app again. Doesn't always happen)

What version of Home Assistant Core has the issue?

core-2023.9.0b1

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Home Assistant iOS app 2023.4 / also reproduced with just Safari

Which operating system are you using to run this browser?

iOS 17 Dev Beta 8 / also reproduced on iOS 16.x

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

tjhorner commented 1 year ago

This issue is still present in frontend version 20231002.0.

If someone can point me in the general direction of where I should look, I can try to contribute a fix!

silamon commented 1 year ago

If someone can point me in the general direction of where I should look, I can try to contribute a fix!

The problem is located in https://github.com/home-assistant/frontend/blob/53b8d1bb0a8dd5f14473f572e66dde37270ec25f/src/panels/logbook/ha-logbook.ts#L380-L404.

Upon reconnection, it receives the logbook entries again and fails to filter out duplicate logbook entries.

github-actions[bot] commented 9 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

TheJulianJES commented 9 months ago

Still reproducible on HA core-2024.1.4

neilbrookins commented 8 months ago

This issue also happens on android companion app. To reproduce, let the screen with the logbook timeout to the lockscreen and unlock. Or also just switch to another app and use for a while then switch back to the ha app and it will show duplicates. This is not as easy to reproduce as on iOS. It seems intermittent.

This issue still occurs with core 2024.2.5.

I can reproduce this on iOS without waiting 30 seconds. Just do a horizontal swipe to switch to another app and do something there for like 5 seconds and then swipe back to the ha app and the logbook will show duplicates.

I was not able to reproduce this on chrome on windows 10. But that could just be I’m not sure how to trigger the refresh.

github-actions[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

neilbrookins commented 5 months ago

I’m running latest ha and iOS app. Just re-tested and the issue still occurs. It’s easy to reproduce. View any logbook list of events. Swipe right/left to use a different app for like 5 seconds and then swipe back to the ha app. The entries are now duplicated 2 times. I repeated the test again with swiping and now there are 3 entries instead of 1 or 2. It’s the act of going to another app and back to ha that causes a refresh where the refresh is duplicating it.

bugarovic commented 1 month ago

Running HA-core-2024.9.3, iOS 17.6.1, Home Assistant Companion app 2024.9.2, retested now and the issue still occurs. Same experience as @neilbrookins.

wormuths commented 1 day ago

Same here...