Skip to content

Conversation

@sroy3
Copy link
Contributor

@sroy3 sroy3 commented Dec 1, 2023

Part of #4867

Demo

Screen.Recording.2023-12-12.at.10.08.36.PM.mov

Things should be as before, but faster

@sroy3 sroy3 self-assigned this Dec 1, 2023
@sroy3 sroy3 marked this pull request as ready for review December 13, 2023 03:12
renderAppWithOptionalDataInDragAndDropMode(
{
custom: customPlotsFixture,
template: templatePlotsFixture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] From the test title it sounds like these plots are needed. Do the statements need to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was never testing the other part. I guess we need to update the statement.

.includes(endingNode.id)
).toBe(true)
within(headerWrapper).getByTestId('comparison-drop-target')
).toBeInTheDocument()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] How do these assertions differ/relate to one another?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not wrapped the exact same way, but the test checks the same thing, it was just not written in a clear way before.

onLayoutChange: () => void
setOrder: (order: string[]) => void
order: string[]
bodyRef?: React.RefObject<HTMLTableSectionElement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Should this be RefObject? (I am asking because that is what I've been using)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied and pasted without verifying. I'll fix it.


act(() => {
jest.advanceTimersByTime(1)
jest.advanceTimersByTime(501)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't. I added dragLeave in there to test something and the 500 was needed then. Turns out that wasn't how to solve the test and I forgot to revert this.

| null

export type Any = BaseType | BaseType[]
type Any = BaseType | BaseType[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

pascalCase: true
},
ignore: [/.*\.stories.tsx$/, /.*\.test\.tsx$/]
ignore: [/.*\.stories.tsx$/, /.*\.test\.tsx$/, /.*use.*\.tsx$/]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning for adding this? I'm not seeing any new files with this syntax 🤔

Copy link
Contributor Author

@sroy3 sroy3 Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useDragAndDrop.tsx there is some jsx in that file


const { immediateDragLeave, immediateDragEnter, deferredDragLeave } =
useDeferredDragLeave()
const {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 5 locations. Consider refactoring.

}
}

export const useDragAndDrop = ({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function useDragAndDrop has a Cognitive Complexity of 36 (exceeds 6 allowed). Consider refactoring.


export const { changeRef, setGroup, setDraggedOverGroup } =
dragDropSlice.actions
export const {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 7ce4da3 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 3

The test coverage on the diff in this pull request is 96.6% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.2% (0.0% change).

View more on Code Climate.

@sroy3 sroy3 merged commit 1f31bd5 into main Dec 13, 2023
@sroy3 sroy3 deleted the drag-drop-hook branch December 13, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants