File tree Expand file tree Collapse file tree 5 files changed +21
-15
lines changed Expand file tree Collapse file tree 5 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ being virtualized with react-virtuoso.
12
12
13
13
import { CSSProperties , ReactNode , useState } from "react" ;
14
14
import { Icon } from "./icon" ;
15
-
16
15
import { DndContext , DragOverlay } from "@dnd-kit/core" ;
17
16
import {
18
17
SortableContext ,
Original file line number Diff line number Diff line change @@ -419,13 +419,15 @@ export const CellList: React.FC<CellListProps> = (props: CellListProps) => {
419
419
delayRendering, // seems not used anywhere!
420
420
isFirst,
421
421
isLast,
422
+ isDragging,
422
423
} : {
423
424
id : string ;
424
425
isScrolling ?: boolean ;
425
426
index ?: number ;
426
427
delayRendering ?: number ;
427
428
isFirst ?: boolean ;
428
429
isLast ?: boolean ;
430
+ isDragging ?: boolean ;
429
431
} ) {
430
432
const cell = cells . get ( id ) ;
431
433
if ( cell == null ) return null ;
@@ -475,6 +477,7 @@ export const CellList: React.FC<CellListProps> = (props: CellListProps) => {
475
477
isLast = { isLast }
476
478
dragHandle = { dragHandle }
477
479
read_only = { read_only }
480
+ isDragging = { isDragging }
478
481
/>
479
482
</ div >
480
483
) ;
@@ -691,14 +694,15 @@ export const CellList: React.FC<CellListProps> = (props: CellListProps) => {
691
694
disabled = { actions == null }
692
695
items = { cell_list . toJS ( ) }
693
696
Item = { ( { id } ) => (
697
+ /* This is what is displayed when dragging the given cell. */
694
698
< div
695
699
style = { {
696
700
background : "white" ,
697
701
boxShadow : "8px 8px 4px 4px #ccc" ,
698
702
fontSize : `${ font_size } px` ,
699
703
} }
700
704
>
701
- { renderCell ( { id } ) }
705
+ { renderCell ( { id, isDragging : true } ) }
702
706
</ div >
703
707
) }
704
708
onDragStart = { ( id ) => {
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ interface CellOutputProps {
32
32
style ?: React . CSSProperties ;
33
33
divRef ?;
34
34
llmTools ?: LLMTools ;
35
+ isDragging ?: boolean ;
35
36
}
36
37
37
38
export function CellOutput ( {
@@ -48,6 +49,7 @@ export function CellOutput({
48
49
divRef,
49
50
style,
50
51
llmTools,
52
+ isDragging,
51
53
} : CellOutputProps ) {
52
54
const minHeight = complete ? "60vh" : undefined ;
53
55
@@ -94,6 +96,7 @@ export function CellOutput({
94
96
name = { name }
95
97
trust = { trust }
96
98
llmTools = { llmTools }
99
+ isDragging = { isDragging }
97
100
/>
98
101
</ div >
99
102
) ;
@@ -109,6 +112,7 @@ interface OutputColumnProps {
109
112
name ?: string ;
110
113
trust ?: boolean ;
111
114
llmTools ?;
115
+ isDragging ?: boolean ;
112
116
}
113
117
114
118
function OutputColumn ( {
@@ -121,7 +125,14 @@ function OutputColumn({
121
125
name,
122
126
trust,
123
127
llmTools,
128
+ isDragging,
124
129
} : OutputColumnProps ) {
130
+ if ( isDragging ) {
131
+ // stable html + dragging breaks badly since you end up with two copies
132
+ // of the same thing, etc. Also, not carrying the output makes seeing
133
+ // what is going on more manageable.
134
+ return null ;
135
+ }
125
136
if ( cell . get ( "collapsed" ) ) {
126
137
return < CollapsedOutput actions = { actions } id = { id } /> ;
127
138
}
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ interface Props {
60
60
isLast ?: boolean ;
61
61
dragHandle ?: JSX . Element ;
62
62
read_only ?: boolean ;
63
+ isDragging ?: boolean ;
63
64
}
64
65
65
66
function areEqual ( props : Props , nextProps : Props ) : boolean {
@@ -88,7 +89,8 @@ function areEqual(props: Props, nextProps: Props): boolean {
88
89
( nextProps . complete !== props . complete && // only worry about complete when editing this cell
89
90
( nextProps . is_current || props . is_current ) ) ||
90
91
nextProps . dragHandle !== props . dragHandle ||
91
- nextProps . read_only !== props . read_only
92
+ nextProps . read_only !== props . read_only ||
93
+ nextProps . isDragging !== props . isDragging
92
94
) ;
93
95
}
94
96
@@ -164,6 +166,7 @@ export const Cell: React.FC<Props> = React.memo((props: Props) => {
164
166
trust = { props . trust }
165
167
complete = { props . is_current && props . complete != null }
166
168
llmTools = { props . llmTools }
169
+ isDragging = { props . isDragging }
167
170
/>
168
171
) ;
169
172
}
Original file line number Diff line number Diff line change @@ -63,18 +63,7 @@ interface CellOutputMessageProps {
63
63
export const CellOutputMessage : React . FC < CellOutputMessageProps > = React . memo (
64
64
( props : CellOutputMessageProps ) => {
65
65
const C : any = messageComponent ( props . message ) ;
66
- return (
67
- < C
68
- message = { props . message }
69
- project_id = { props . project_id }
70
- directory = { props . directory }
71
- actions = { props . actions }
72
- name = { props . name }
73
- trust = { props . trust }
74
- id = { props . id }
75
- index = { props . index }
76
- />
77
- ) ;
66
+ return < C { ...props } /> ;
78
67
} ,
79
68
) ;
80
69
You can’t perform that action at this time.
0 commit comments