Skip to content

Commit 4f89a6f

Browse files
authored
feat(react): forward autoResize from useApp to App (#622)
useApp() previously hardcoded autoResize: true. Expose it as a hook option (default unchanged) so callers can disable the built-in ResizeObserver and drive sizing themselves.
1 parent 94c9421 commit 4f89a6f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/react/useApp.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ export * from "../app";
1212
/**
1313
* Options for configuring the {@link useApp `useApp`} hook.
1414
*
15-
* The `strict` option is forwarded to the underlying {@link App `App`}
16-
* instance. For other {@link AppOptions `AppOptions`}, create the `App`
17-
* manually instead of using this hook.
15+
* The `autoResize` and `strict` options are forwarded to the underlying
16+
* {@link App `App`} instance. For other {@link AppOptions `AppOptions`},
17+
* create the `App` manually instead of using this hook.
1818
*
1919
* @see {@link useApp `useApp`} for the hook that uses these options
2020
* @see {@link useAutoResize `useAutoResize`} for manual auto-resize control with custom `App` options
2121
*/
22-
export interface UseAppOptions extends Pick<AppOptions, "strict"> {
22+
export interface UseAppOptions extends Pick<
23+
AppOptions,
24+
"autoResize" | "strict"
25+
> {
2326
/** App identification (name and version) */
2427
appInfo: Implementation;
2528
/**
@@ -126,6 +129,7 @@ export function useApp({
126129
appInfo,
127130
capabilities,
128131
onAppCreated,
132+
autoResize = true,
129133
strict,
130134
}: UseAppOptions): AppState {
131135
const [app, setApp] = useState<App | null>(null);
@@ -141,10 +145,7 @@ export function useApp({
141145
window.parent,
142146
window.parent,
143147
);
144-
const app = new App(appInfo, capabilities, {
145-
autoResize: true,
146-
strict,
147-
});
148+
const app = new App(appInfo, capabilities, { autoResize, strict });
148149

149150
// Register handlers BEFORE connecting
150151
onAppCreated?.(app);

0 commit comments

Comments
 (0)