Skip to content

Commit

Permalink
attempt to resolve hyperlist issue with flushSync
Browse files Browse the repository at this point in the history
  • Loading branch information
jthrilly committed Dec 11, 2023
1 parent 8b9d1bb commit a69f3d7
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 363 deletions.
6 changes: 6 additions & 0 deletions app/(interview)/interview/_components/InterviewShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const ServerSync = ({ interviewId }: { interviewId: string }) => {
return;
}

// check if current stage index is null (happens when hot reloading)
if (currentSession.currentStep === null) {
console.log('⚠️ Current stage index is null. Skipping sync.');
return;
}

console.log(`⬆️ Syncing session with server...`);
syncSessionWithServer({
id: interviewId,
Expand Down
319 changes: 0 additions & 319 deletions lib/interviewer/behaviours/DragAndDrop/DragAndDropSlice.ts

This file was deleted.

44 changes: 25 additions & 19 deletions lib/interviewer/behaviours/DragAndDrop/DragSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const dragSource = (WrappedComponent) => ({
x, y, setValidMove, ...other,
}),
);
}, 60);
}, 250);

const onDragMove = ({ x, y, ...other }) => {
updatePreview({ x, y });
Expand Down Expand Up @@ -111,26 +111,32 @@ const dragSource = (WrappedComponent) => ({
const styles = () => (isDragging ? { visibility: 'hidden' } : {});

return (
<div style={styles()} className={`draggable ${!allowDrag ? 'draggable--disabled' : ''}`} ref={node}>
<WrappedComponent
{...rest}
allowDrag={allowDrag}
scrollDirection={scrollDirection}
/>
{preview && (
<div
ref={previewRef}
style={{
display: 'none',
position: 'absolute',
top: 0,
left: 0,
}}
>
{preview}
<>
{!isDragging && (
<div className={`draggable ${!allowDrag ? 'draggable--disabled' : ''}`} ref={node}>
<WrappedComponent
{...rest}
allowDrag={allowDrag}
scrollDirection={scrollDirection}
/>
</div>
)}
</div>
{
preview && (
<div
ref={previewRef}
style={{
display: 'none',
position: 'absolute',
top: 0,
left: 0,
}}
>
{preview}
</div>
)
}
</>
);
};

Expand Down
Loading

0 comments on commit a69f3d7

Please sign in to comment.