Keep selection on tvOS when reloading with components
zenangst opened this issue ยท 3 comments
Currently, when the Controller
is reloaded with [Component]
, the interface loses its current selection. This should not happen, I would even go as far as to call it a ๐.
Made an initial implementation for this here - https://github.com/hyperoslo/Spots/pull/408
The idea was to give focus to the last focused Spotable
component using the new SpotsFocusDelegate
. However, seeing as we are replacing the composite when we reload it, the focusedSpot
on SpotsFocusDelegate
gets set to nil
.
If we can solve the issue that I mentioned in the PR. Then I think it can be solved.
Reference #408
I also attempted to improve how composites are reloaded. Right now the composite spots get replaced when ever a composite container is changed. There is potential for improvement here. However I ran into a weird crash related to tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath).
The stack trace can be found here.
https://gist.github.com/zenangst/1a7662f81e4abb0071a1bc88493e9fac
This happens when I try to get the prepared items from the temporary spot and add them to the already existing one.
The odd thing is, if you remove the delegate implementation, it reloads just fine.
I just tested this on master
. If the indexPath
still exists after the updated then it will keep the selection. I'll go ahead and close this issue now :)