Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
James Woo committed Jul 19, 2021
1 parent c731a54 commit d688e85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/host/RemoteText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {memo} from 'react';
import type {RemoteTextProps} from './types';
import {useAttached} from './hooks';

export function renderText({text, receiver, ...extraProps}: RemoteTextProps) {
return <RemoteText {...extraProps} text={text} receiver={receiver} />;
export function renderText({text, receiver, key}: RemoteTextProps) {
return <RemoteText key={key} text={text} receiver={receiver} />;
}

export const RemoteText = memo(({text, receiver}: RemoteTextProps) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/host/controller.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ComponentType, ReactElement} from 'react';
import type {ComponentType, ReactNode} from 'react';
import type {
Controller,
RemoteComponentProps,
Expand All @@ -19,8 +19,8 @@ interface RendererFactory {
renderComponent(
props: RemoteComponentProps,
options: RenderComponentOptions,
): ReactElement;
renderText(props: RemoteTextProps, options: RenderTextOptions): ReactElement;
): ReactNode;
renderText(props: RemoteTextProps, options: RenderTextOptions): ReactNode;
}

const renderComponentOptions = {renderDefault: defaultRenderComponent};
Expand All @@ -38,7 +38,7 @@ export function createController(
? (component) => externalRenderComponent(component, renderComponentOptions)
: defaultRenderComponent;
const renderText: Renderer['renderText'] = externalRenderText
? (component) => externalRenderText(component, renderTextOptions)
? (text) => externalRenderText(text, renderTextOptions)
: defaultRenderText;

return {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/host/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ComponentType, ReactElement} from 'react';
import type {ComponentType, ReactNode} from 'react';
import type {
RemoteReceiver,
RemoteReceiverAttachableComponent,
Expand Down Expand Up @@ -32,8 +32,8 @@ export interface Controller {
}

export interface Renderer {
renderComponent(props: RemoteComponentProps): ReactElement;
renderText(props: RemoteTextProps): ReactElement;
renderComponent(props: RemoteComponentProps): ReactNode;
renderText(props: RemoteTextProps): ReactNode;
}

export interface RenderComponentOptions {
Expand Down

0 comments on commit d688e85

Please sign in to comment.