iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
8 stars 2 forks source link

Pass a hook to the widget to convey state #554

Closed a-gagnon closed 8 months ago

a-gagnon commented 10 months ago

Is your feature request related to a problem? Please describe. I believe this is something that Raphael L pitched at some point. It'd be nice to have a hook that gives the widget some information about its current state, be it passed down as part of the props object or by calling the hook explicitly. Information may include whether it's in popout state, if it's displayed currently, etc.

As of right now, it seems the way to do this is by passing the widgetId to the Widget component and have it call static functions from the framework (eg. UiFramework.frontstages.activeFrontstageDef?.findWidgetDef(widgetId)). The whole thing feels like an antipattern as widget shouldn't need to know (or care for) the widgetId to begin with.

Thanks! Alex

raplemie commented 10 months ago

This is referring to #199 last point, we'll look into improving this.