You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This UI component shouldn't crash app. Or at least, we can have an alternative to crash (runtime error log?)
Priorities and help requested:
Are you willing to submit a PR to fix? No. Or yes if we have a clear path to fix it.
Requested priority: Normal
The text was updated successfully, but these errors were encountered:
imWildCat
changed the title
Tooltip could crash during runtime because of
Tooltip could crash during runtime because of preconditionFailure()Jun 20, 2021
Thanks for the feedback. runtime error log is bit messy to do as a shared UI library because each client team might have different way of error logging and most of the time developers tend to ignore logs on the console. I think author's thoughts were to make sure clients understand the tooltip is actually showing on a valid anchor view and crashing might be the best way to debug user scenarios if things are not shown in intended way.
Yeah, I agree the anchorView should be in the view hierarchy (and the window of it shouldn't be nil) while showing Tooltip.
This should be a precondition.
Could we consider other alternative approach? Like returning a Result<Void, Error> enum to make it more flexible?
In large apps, the view hierarchy could be complex. As a result, when Tooltip.show() is executed by the runloop, the anchorView.window might be nil even if the developer is very careful about it.
Environment Information
Please provide a reproduction of the bug:
The
anchorView
'swindow
can be nil when it got removed from the view hierarchy.In this situation,
preconditionFailure()
will lead to runtime crash.Since
Tooltip
isn't a critical UI for most business logic, should we crash the app when this exception happens?I searched for
preconditionFailure()
in this repo (https://github.com/microsoft/fluentui-apple/search?p=1&q=preconditionFailure) and found that most of its use is for unimplemented initializers.Actual behavior:
Tooltip could crash the app.
Expected behavior:
This UI component shouldn't crash app. Or at least, we can have an alternative to crash (runtime error log?)
Priorities and help requested:
Are you willing to submit a PR to fix? No. Or yes if we have a clear path to fix it.
Requested priority: Normal
The text was updated successfully, but these errors were encountered: