Skip to content

Commit

Permalink
🐛 fix(awareness): 兼容服务端渲染
Browse files Browse the repository at this point in the history
  • Loading branch information
meganjohnson96 committed Jun 18, 2023
1 parent b0ea605 commit 1c04874
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Awareness/Avatars/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Avatar as A, Badge, Tooltip } from 'antd';
import Color from 'color';
import { memo } from 'react';

interface AvatarProps {
export interface AvatarProps {
/**
* 用户名
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Awareness/Cursors/Cursor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useStyles = createStyles(({ css }) => ({
`,
}));

interface CursorProps {
export interface CursorProps {
position: { x: number; y: number };
color: string;
name: string;
Expand Down
15 changes: 0 additions & 15 deletions src/Awareness/index.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/Awareness/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Avatar from './Avatars/Avatar';

import { lazy, Suspense } from 'react';
import { AwarenessProps } from './Awareness';
import Cursor from './Cursors/Cursor';

export type { AwarenessProps } from './Awareness';

const Basic = lazy(() => import('./Awareness'));

const Awareness = (props: AwarenessProps) => {
return (
<Suspense>
<Basic {...props} />
</Suspense>
);
};

Awareness.Cursor = Cursor;
Awareness.Avatar = Avatar;

export default Awareness;

0 comments on commit 1c04874

Please sign in to comment.