Commit fad8236
Rustem Mussabekov
Fix issue when one of a children is undefined
Firstly huge thanks for such amazing module!
In some edge cases (like in my own) there can be a `undefined` React child. Easy to reproduce:
```js
<ReactSortable>
{some_var ? <li>123</li> : undefined}
<li>123</li>
</ReactSortable>
```
In such case crash happen because code can't read property of undefined object.
Just check changes that I made into `react-sortable.tsx` file you will understand what I'm trying to achieve.
I also changed this line from `const item = list[index];` to `const item = list[index] || {};` , just to be sure that if list doesn't have particular index, whole code not fail.
This two changes are made to prevent edge case crashes. In my own app I spend a lot of time to find out why sometime app is crashing.
Please, please approve this pull request!1 parent a104520 commit fad8236
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
0 commit comments