android icon indicating copy to clipboard operation
android copied to clipboard

Save the last response so we can properly unsubscribe from events when the response ID has changed

Open dshokouhi opened this issue 1 year ago • 4 comments

Summary

This PR attempts to fix #2774 by keeping track of the lastResponse so we can unsubscribe with the correct response ID.

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

dshokouhi avatar Aug 09 '22 17:08 dshokouhi

This will create problems when using multiple subscriptions of different types, for example when adding device controls or in the Wear OS app. The app will try to unsubscribe from all subscriptions with the ID of the last subscription.

Thanks I didn't see this initially but it seems my logcat filtering was not correct 🤦

dshokouhi avatar Aug 09 '22 18:08 dshokouhi

Ok looks like the subscriptions and unsubscriptions are working as expected now

dshokouhi avatar Aug 09 '22 19:08 dshokouhi

It works and fixes the bug the user mentioned in their comment on the issue 👍

Potential improvement: store only the id in the response that is returned instead of the entire response, as only the ID is used.

jpelgrom avatar Aug 09 '22 21:08 jpelgrom

Potential improvement: store only the id in the response that is returned instead of the entire response, as only the ID is used.

Done, now only storing the ID :)

dshokouhi avatar Aug 09 '22 21:08 dshokouhi