Components: Add types to Draggable#29792
Conversation
|
Size Change: +2 B (0%) Total Size: 1.41 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
That seems like an existing bug. Wondering how/what it does.. Looking at: https://github.com/WordPress/gutenberg/pull/26897/files
There was a problem hiding this comment.
I'm also not sure about this one. Any suggestions on how to test its impact?
There was a problem hiding this comment.
Sorry, I should have mentioned this in the PR description, I totally glossed over that this was a fix.
Not sure how to measure its impact, but theoretically any onDragEnd event that was supposed to be fired was not being fired due to the lack of an onDragOver. That sounds pretty bad in the context of this component 😬
I did some digging and it doens't look like Draggable is even used in the Gutenberg codebase so there's no way to test it here 😕
There was a problem hiding this comment.
Maybe if we ping the author of the original code?
There was a problem hiding this comment.
@ellatrix As you did the original refactor to a function component, do you mind chiming in on this? Is there a good way to test the result of this bug fix?
There was a problem hiding this comment.
It is used:
Drag and drop is hard to test, but manually by testing the block drag handle.
There was a problem hiding this comment.
Ah, I don't know how I missed those usages!
Luckily, this bug would never have affected those two usages. One does not use the onDrag* events passed to Draggable at all and the other passes both onDragOver and onDragEnd meaning that this bug wouldn't have affected it.
Block dragging continues to work as expected.
There was a problem hiding this comment.
That's good. No tests required imo.
tyxla
left a comment
There was a problem hiding this comment.
Looking good 👍 The null change also looks safe. Left a couple of questions.
There was a problem hiding this comment.
I'm also not sure about this one. Any suggestions on how to test its impact?
b0248c2 to
7c327c2
Compare
7c327c2 to
2722dd5
Compare
Description
Adds types to the
Draggablecomponent. No runtime changes except to change the ref from defaulting toundefinedto default tonull. This should have no real effect as the null checks were just checking for flasy-ness rather thanundefinedspecifically.Part of #18838
How has this been tested?
Storybook (
npm run storybook:dev) and the Draggable story continues to work as expected. Again, there are no runtime changes except the minor one I mention above so the main thing is that type checks pass 🙂Types of changes
Non-breaking change.
Checklist: