Skip to content

Commit 41fe283

Browse files
mschristensenclaude
andcommitted
react: rename ViewOptions to UseViewOptions, fix error types
Rename the React hook's ViewOptions to UseViewOptions to avoid a name collision with the internal ViewOptions in view.ts. Use Ably.ErrorInfo instead of plain Error for the view-unavailable guard in useView's send/regenerate/edit callbacks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6ad630f commit 41fe283

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/react/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export { useRegenerate } from './use-regenerate.js';
66
export { useSend } from './use-send.js';
77
export type { TreeHandle } from './use-tree.js';
88
export { useTree } from './use-tree.js';
9-
export type { ViewHandle, ViewOptions } from './use-view.js';
9+
export type { UseViewOptions, ViewHandle } from './use-view.js';
1010
export { useView } from './use-view.js';

src/react/use-view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { ActiveTurn, ClientTransport, SendOptions, TreeNode, View } from '.
1414
import { ErrorCode } from '../errors.js';
1515

1616
/** Options for configuring the view's initial load behavior. */
17-
export interface ViewOptions {
17+
export interface UseViewOptions {
1818
/** Maximum number of older messages to load per page. Defaults to 100. */
1919
limit?: number;
2020
}
@@ -71,7 +71,7 @@ const resolveView = <TEvent, TMessage>(
7171
*/
7272
export const useView = <TEvent, TMessage>(
7373
source: ClientTransport<TEvent, TMessage> | View<TEvent, TMessage> | null | undefined,
74-
options?: ViewOptions | null,
74+
options?: UseViewOptions | null,
7575
): ViewHandle<TEvent, TMessage> => {
7676
const view = resolveView(source ?? undefined);
7777

0 commit comments

Comments
 (0)