-
Notifications
You must be signed in to change notification settings - Fork 2
Move deprecated AppUI functionality into mobile-ui-react. #75
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
base: main
Are you sure you want to change the base?
Changes from all commits
48bc75d
fa04ec8
7e30ace
3b03df8
852d7dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,12 @@ import * as React from "react"; | |
| import { BackendError, Localization } from "@itwin/core-common"; | ||
| import { | ||
| ColorTheme, | ||
| SessionStateActionId, | ||
| SyncUiEventDispatcher, | ||
| SyncUiEventId, | ||
| SYSTEM_PREFERRED_COLOR_THEME, | ||
| UiFramework, | ||
| UiSyncEventArgs, | ||
| useActiveIModelConnection, | ||
| } from "@itwin/appui-react"; | ||
| import { EmphasizeElements, IModelApp, IModelConnection, ScreenViewport, SelectionSet, Tool, Viewport } from "@itwin/core-frontend"; | ||
| import { BeEvent, BeUiEvent, BriefcaseStatus, Id64Set, Listener } from "@itwin/core-bentley"; | ||
|
|
@@ -27,6 +27,30 @@ import { | |
|
|
||
| import "./MobileUi.scss"; | ||
|
|
||
| /** Props used by components that expect class name to be passed in. | ||
| * | ||
| * __Note__: Copied from @itwin/core-react, where it is being deprecated. It will **not ever** be | ||
| * deprecated from @itwin/mobile-ui-react. | ||
| * @public | ||
| */ | ||
| export interface ClassNameProps { | ||
| /** Custom CSS class name */ | ||
| className?: string; | ||
| } | ||
|
|
||
| /** Common props used by components. | ||
| * | ||
| * __Note__: Copied from @itwin/core-react, where it is being deprecated. It will **not ever** be | ||
| * deprecated from @itwin/mobile-ui-react. | ||
| * @public | ||
| */ | ||
| export interface CommonProps extends ClassNameProps { | ||
| /** Custom CSS style properties */ | ||
| style?: React.CSSProperties; | ||
| /** Optional unique identifier for item. If defined it will be added to DOM Element attribute as data-item-id */ | ||
| itemId?: string; | ||
| } | ||
|
|
||
| /** Type used for MobileUi.onClose BeEvent. */ | ||
| export declare type CloseListener = () => void; | ||
|
|
||
|
|
@@ -558,11 +582,10 @@ export function useIsolatedCount(): number { | |
| * @param handler - The callback function. | ||
| */ | ||
| export function useIModel(handler: (iModel: IModelConnection | undefined) => void) { | ||
| useSyncUiEvent(React.useCallback(() => { | ||
| handler(UiFramework.getIModelConnection()); | ||
| // @todo AppUI deprecation | ||
| // eslint-disable-next-line deprecation/deprecation | ||
| }, [handler]), SessionStateActionId.SetIModelConnection); | ||
| const iModelConnection = useActiveIModelConnection(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest calling I think having Field update their code to call
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| React.useMemo(() => { | ||
| handler(iModelConnection); | ||
| }, [iModelConnection, handler]); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.