chore(examples): only use bundle
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { memo, FC, useMemo, CSSProperties } from 'react';
|
||||
import { Handle, Position, NodeProps } from '@react-flow/core';
|
||||
import { Handle, Position, NodeProps } from '@react-flow/bundle';
|
||||
|
||||
const nodeStyles: CSSProperties = { padding: 10, border: '1px solid #ddd' };
|
||||
|
||||
@@ -11,7 +11,7 @@ const CustomNode: FC<NodeProps> = ({ data }) => {
|
||||
return (
|
||||
<Handle
|
||||
key={handleId}
|
||||
type='source'
|
||||
type="source"
|
||||
position={Position.Right}
|
||||
id={handleId}
|
||||
style={{ top: 10 * i + data.handlePosition * 10 }}
|
||||
@@ -23,7 +23,7 @@ const CustomNode: FC<NodeProps> = ({ data }) => {
|
||||
|
||||
return (
|
||||
<div style={nodeStyles}>
|
||||
<Handle type='target' position={Position.Left} />
|
||||
<Handle type="target" position={Position.Left} />
|
||||
<div>output handle count: {data.handleCount}</div>
|
||||
{handles}
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
Position,
|
||||
useNodesState,
|
||||
useEdgesState,
|
||||
} from '@react-flow/core';
|
||||
} from '@react-flow/bundle';
|
||||
|
||||
import CustomNode from './CustomNode';
|
||||
|
||||
@@ -48,10 +48,7 @@ const getId = (): string => `${id++}`;
|
||||
const UpdateNodeInternalsFlow = () => {
|
||||
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
||||
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
||||
const onConnect = useCallback(
|
||||
(params: Edge | Connection) => setEdges((els) => addEdge(params, els)),
|
||||
[setEdges]
|
||||
);
|
||||
const onConnect = useCallback((params: Edge | Connection) => setEdges((els) => addEdge(params, els)), [setEdges]);
|
||||
|
||||
const updateNodeInternals = useUpdateNodeInternals();
|
||||
const { project } = useReactFlow();
|
||||
@@ -98,10 +95,7 @@ const UpdateNodeInternalsFlow = () => {
|
||||
);
|
||||
}, [setNodes]);
|
||||
|
||||
const updateNode = useCallback(
|
||||
() => updateNodeInternals('1'),
|
||||
[updateNodeInternals]
|
||||
);
|
||||
const updateNode = useCallback(() => updateNodeInternals('1'), [updateNodeInternals]);
|
||||
|
||||
return (
|
||||
<ReactFlow
|
||||
|
||||
Reference in New Issue
Block a user