react-tv-navigation icon indicating copy to clipboard operation
react-tv-navigation copied to clipboard

Makes focusPath prop optional

Open celiolatorraca opened this issue 8 years ago • 0 comments

For now, the focusPath is required. What would be the best approach to change it?

What is the problem?

As a react-based component, we lay on react lifecycle...

  • After a component mounts, we register it to focus manager and if there is no focusPath provided, the manager generates a new one.
  • When this component is re-rendered, as a normal react component, we unregister this component from the focus manager while unmounting it, then register again after mounting the new one.

But, if we are generating a new focusPath for components that didn't provide one, after this cycle we would have a currentFocusPath (injected by withNavigation) pointing to an element that was already unmounted...

What do you think we can do to avoid this?

celiolatorraca avatar Jan 22 '18 21:01 celiolatorraca