-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move deprecated AppUI functionality into mobile-ui-react. #75
base: main
Are you sure you want to change the base?
Conversation
* deprecated from @itwin/mobile-ui-react. | ||
* @public | ||
*/ | ||
export interface ClassNameProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets review with the appui team why this was deprecated, and what they expected consumers to do, before we re-export a deprecated type from another repo as public here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to draft for now while we decide what to do and created a new PR to allow lint to pass.
// @todo AppUI deprecation | ||
// eslint-disable-next-line deprecation/deprecation | ||
}, [handler]), SessionStateActionId.SetIModelConnection); | ||
const iModelConnection = useActiveIModelConnection(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest removing this function since it doesn't add anything that can't be accomplished with useActiveIModelConnection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SYNCHRO Field uses it in one place, and they take advantage of the fact that they get a callback when it happens. They don't actually care about the value, simply that it changed:
useIModel(() => {
reset();
});
Obviously they could update their code to React.useMemo
like I do here. I guess we could ask them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest calling useEffect
instead of useMemo
since the latter is meant for memoizing calculated data (i.e. storing the return value of useMemo
).
I think having Field update their code to call useActiveIModelConnection
makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If SYNCHRO agrees with us removing useIModel, this discussion is moot, but based on my understanding of how useEffect and useMemo work, useEffect will cause an extra render at startup and every time the value changes. Having said that, I am well aware that this is a very non-standard usage of useMemo, so maybe the extra render is not something to worry about.
No description provided.