-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render only needed sortable items #1096
Open
alissaVrk
wants to merge
35
commits into
clauderic:master
Choose a base branch
from
alissaVrk:render-only-needed-sortable-items
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
625f8d1
active and active event ok
alissaVrk dd88743
no re-render non dragged items on drag start / end
alissaVrk 9241989
rename
alissaVrk 38e3c18
remove active from reducer
alissaVrk ef3d7d8
add test for useDraggable for render only dragging element
alissaVrk ca2b3dc
do not re-render draggable and droppabale when over changes
alissaVrk 10ec00d
remove dragging css class from droppable story, it did nothing and cr…
alissaVrk acdfb55
remove hasActive from useDroppable
alissaVrk 18a7ce5
add test for render only relevant draggable element and container
alissaVrk 618d22b
sortable renders story
alissaVrk 83207fb
runs, not rendering all
alissaVrk a873505
some fixes
alissaVrk cd2d0d4
calculate hasActive in useSortable
alissaVrk b356522
fix default context for drag overlay
alissaVrk 3f15507
Merge branch 'render-only-dragging-item' into render-only-over-item
alissaVrk 950e42e
Merge branch 'render-only-over-item' into render-only-needed-sortable…
alissaVrk 1affa4f
can drag over in sortable without re-render all. some small issues to…
alissaVrk 95199cb
clean up
alissaVrk 503adb8
return strategy delta for active as well
alissaVrk 1ab04f7
do not animate drop by default
alissaVrk 6dbc5f8
pass over from droppable as well (more useful)
alissaVrk 33bf5e1
fix pages story
alissaVrk 67e219c
fix drawer example
alissaVrk d2d5043
fix type in switch
alissaVrk ab54c30
Merge branch 'render-only-dragging-item' into render-only-needed-sort…
alissaVrk f79a6e1
types and styling in stories
alissaVrk dc114ec
add active for over item
alissaVrk 1c7be36
cache prev items and container in item and expose global active ref i…
alissaVrk 90d0baf
add useConditionalDndContext
alissaVrk a19a3e2
add test for render only needed sortable items
alissaVrk d93b2af
fix strategy delta diffs and pass disable transforms only for active …
alissaVrk baf7e7e
add tests for drop + memo items in test
alissaVrk 38cd6e9
remove only
alissaVrk 64a4c7a
uncomment items dependency
alissaVrk 358d37d
fix typo
alissaVrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/// <reference path="../support/index.d.ts" /> | ||
|
||
describe('Droppable', () => { | ||
describe('Droppable Renders', () => { | ||
it('should re-render only the dragged item and the container dragged over - no drop', () => { | ||
cy.visitStory('core-droppablerenders-usedroppable--multiple-droppables'); | ||
|
||
cy.get('[data-cypress="droppable-container-A"]').then((droppable) => { | ||
const coords = droppable[0].getBoundingClientRect(); | ||
return cy | ||
.get('[data-cypress="draggable-item"]') | ||
.first() | ||
.then((draggable) => { | ||
const initialCoords = draggable[0].getBoundingClientRect(); | ||
return cy | ||
.wrap(draggable, {log: false}) | ||
.mouseMoveBy( | ||
coords.x - initialCoords.x + 10, | ||
coords.y - initialCoords.y + 10, | ||
{ | ||
delay: 1000, | ||
noDrop: true, | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
cy.get('[data-testid="draggable-status-1"]').should( | ||
'have.text', | ||
'updated' | ||
); | ||
cy.get('[data-testid="draggable-status-2"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
cy.get('[data-testid="draggable-status-3"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
|
||
cy.get('[data-testid="droppable-status-A"]').should( | ||
'have.text', | ||
'updated' | ||
); | ||
cy.get('[data-testid="droppable-status-B"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
cy.get('[data-testid="droppable-status-C"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
}); | ||
|
||
it('should re-render only the dragged item and the container dragged over - with drop', () => { | ||
cy.visitStory('core-droppablerenders-usedroppable--multiple-droppables'); | ||
|
||
cy.get('[data-cypress="droppable-container-A"]').then((droppable) => { | ||
const coords = droppable[0].getBoundingClientRect(); | ||
return cy | ||
.get('[data-cypress="draggable-item"]') | ||
.last() | ||
.then((draggable) => { | ||
const initialCoords = draggable[0].getBoundingClientRect(); | ||
return cy | ||
.wrap(draggable, {log: false}) | ||
.mouseMoveBy( | ||
coords.x - initialCoords.x + 10, | ||
coords.y - initialCoords.y + 10, | ||
{ | ||
delay: 1000, | ||
noDrop: false, | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
//the dropped item is mounted because it moves to a different container | ||
for (let i = 1; i <= 3; i++) { | ||
cy.get(`[data-testid="draggable-status-${i}"]`).should( | ||
'have.text', | ||
'mounted' | ||
); | ||
} | ||
|
||
cy.get('[data-testid="droppable-status-A"]').should( | ||
'have.text', | ||
'updated' | ||
); | ||
cy.get('[data-testid="droppable-status-B"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
cy.get('[data-testid="droppable-status-C"]').should( | ||
'have.text', | ||
'mounted' | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, just a typo here (should be useGlobalActive)