Skip to content

Conversation

@MatiPl01
Copy link
Owner

@MatiPl01 MatiPl01 commented Sep 7, 2025

Description

This PR adds more performant way of sortable component items rendering. It triggers render only for items that changed instead of going through the entire providers tree from the top to the bottom to re-render an item.

This also will make it possible to change the data in the multizone provider when the item enters another zone (the state can be now controlled from another provider, not only changed via props).

@MatiPl01 MatiPl01 self-assigned this Sep 7, 2025
@vercel
Copy link

vercel bot commented Sep 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
react-native-sortables-docs Ignored Ignored Preview Sep 7, 2025 11:57pm

@MatiPl01 MatiPl01 added performance enhancement New feature or request labels Sep 7, 2025
@MatiPl01 MatiPl01 requested a review from Copilot September 7, 2025 23:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a data provider system for the sortable components, shifting from direct prop passing to a centralized item management approach. The changes establish a provider-based architecture for handling items and their rendering.

  • Introduces new ItemsProvider and ItemsOutlet components for centralized item management
  • Refactors existing components to use the provider pattern instead of direct children/data handling
  • Updates utility functions and helper types to support the new data flow architecture

Reviewed Changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react-native-sortables/src/providers/shared/ItemsProvider/* New provider system for item management with store, hooks, and components
packages/react-native-sortables/src/components/shared/SortableContainer.tsx Updated to use ItemsOutlet instead of direct children rendering
packages/react-native-sortables/src/components/SortableGrid.tsx Refactored to use ItemsProvider and new data flow pattern
packages/react-native-sortables/src/components/SortableFlex.tsx Updated to use provider-based architecture
packages/react-native-sortables/src/utils/order.ts Modified to accept items array instead of itemKeys
packages/react-native-sortables/src/utils/children.ts Renamed function from validateChildren to processChildren
Comments suppressed due to low confidence (3)

packages/react-native-sortables/src/providers/shared/AutoScrollProvider/utils.ts:1

  • [nitpick] The commented out line should be removed rather than left as a comment if it's no longer needed.
'worklet';

packages/react-native-sortables/src/providers/grid/GridLayoutProvider/GridLayoutProvider.tsx:1

  • Using rowHeight ?? 0 could result in incorrect calculations when rowHeight is undefined. This should be handled more explicitly since rowHeight is required for horizontal grids.
import type { PropsWithChildren } from 'react';

packages/react-native-sortables/src/components/SortableGrid.tsx:1

  • The rowHeight parameter might be undefined, which would result in { height: undefined } being applied as a style. This should be handled more explicitly.
import { useLayoutEffect, useMemo, useRef } from 'react';

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MatiPl01 MatiPl01 marked this pull request as ready for review September 7, 2025 23:59
@MatiPl01 MatiPl01 merged commit 5dc34b6 into main Sep 7, 2025
7 checks passed
@MatiPl01 MatiPl01 deleted the feat/data-provider branch September 7, 2025 23:59
MatiPl01 pushed a commit that referenced this pull request Sep 13, 2025
# [1.9.0](v1.8.0...v1.9.0) (2025-09-13)

### Bug Fixes

* A bunch of issues, like shaky scroll, invalid grid layout, added items flickering ([#463](#463)) ([3b160b6](3b160b6))
* Active item touch start position on Android ([#462](#462)) ([7704729](7704729))
* Autoscroll exceeding bounds ([#473](#473)) ([eddd21b](eddd21b))
* Collapsible items implementation on the web ([#485](#485)) ([4d261db](4d261db))
* Collapsible items shift when size changes ([#451](#451)) ([e816b6a](e816b6a))
* Incorrect drag start position, no item size animation when teleported ([#456](#456)) ([1730fb8](1730fb8))
* Invalid builder bob config ([#475](#475)) ([11cf84a](11cf84a))
* Invalid grid layout on mount ([#461](#461)) ([a47ed72](a47ed72))
* onActiveItemDropped not being fired when item is touched quickly ([#449](#449)) ([f66d980](f66d980))
* Pre-release fixes and improvements ([#476](#476)) ([736fb7b](736fb7b))
* Prevent auto scroll from over scrolling content container ([#484](#484)) ([db586d7](db586d7)), closes [#473](#473)

### Features

* Add custom shadow example to docs, clean up decoration style ([#466](#466)) ([1169928](1169928))
* Add example app build check CIs ([#480](#480)) ([5ad420c](5ad420c))
* Add style property to the handle component ([#477](#477)) ([28c9099](28c9099))
* Better collapsible auto-scroll behavior ([#457](#457)) ([2d24b14](2d24b14)), closes [#444](#444)
* Collapsible items support ([#444](#444)) ([66c03b6](66c03b6))
* Data provider ([#472](#472)) ([5dc34b6](5dc34b6))
* Improved teleported items behavior ([#452](#452)) ([72dadef](72dadef))
* Make layout update in sync with positions change on grid columns change ([#441](#441)) ([ef37d8c](ef37d8c))
* New auto scroll implementation ([#454](#454)) ([c4facec](c4facec)), closes [#285](#285) [#453](#453) [#285](#285)

### Performance Improvements

* Optimize rerenders caused by inlined callbacks, clean up drag state management ([#474](#474)) ([f5e3c89](f5e3c89))
* Reduce the number of layout calculations ([#442](#442)) ([f9c9875](f9c9875))
@MatiPl01
Copy link
Owner Author

🎉 This issue has been resolved in version 1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants