Skip to content

Further rendering improvements #986

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrisvxd
Copy link
Member

@chrisvxd chrisvxd commented Apr 12, 2025

Further identified rendering improvements

Re-renders

  1. Changing parent props (like root) causes all children to re-render
  2. Hovering on outline causes re-render of all items
  3. Siblings re-rendering during drag operation

Tasks

  • Memoize DropZoneChild components to prevent re-rendering during reorder
  • Don’t pass preview in as prop to DropZoneChild as this causes prop change and further re-renders. Instead, try zone context store.
  • If possible don’t pass index in as prop into DropZoneChild as this is causing re-renders on duplicate for higher items (needed because of dndkit index). May require use of zone index after slots in Add slots API #984.
  • DropZoneProvider causing various re-renders (and along with a lack of memoizing, is likely responsible for issue (1) and (2))
  • Address other possible issues with existing zustand store implementation in DropZoneEdit (which may be nullified by above changes)
    • Hover
      • Move isDeepestZone to sibling, unless DropZone is empty
      • Refactor inNextDeepestZone class application to use :has
    • Drag start
      • useContentWithPreview refers to draggedItem, which means it will render the entire dropzone on drag start

Closes #644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve rendering performance
1 participant