xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 9 forks source link

Tab Activation Hooks #459

Closed haynesjm42 closed 5 months ago

haynesjm42 commented 6 years ago

To bring TabContainer in line with framework routing libraries and to generally reduce the amount of wiring it takes to use routing it would be nice to have some hooks in place to help streamline the process of setting up routable components.

onActivate(params)

onDeactivate

canActivate(params)

canDeactivate

See https://router5.js.org/advanced/preventing-navigation for how to implement canActivate and canDeactivate with router5.

Also for reference see https://aurelia.io/docs/fundamentals/cheat-sheet#routing for details on how these same hooks work in the Aurelia router.

lbwexler commented 6 years ago

This looks like a fantastic ticket. In theory, you could imagine building it deeper into the framework, but I am hoping that building it into TabContainer will be a sweet spot for adding the most useful functionality with minimal complexity.

Very curious to know how you might be able to support parts of this lifecycle even in the case of a non-route enabled tab container.

Also -- assuming these hooks would be looked for on the Contents of the Tab, rather than the TabModel?

amcclain commented 6 years ago

@haynesjm42 here is another candidate for Hoist work next week.