Explorar el Código

Remove `sync` option from `VirtualList` & update `UIPlugin` render

Merlijn Vos hace 3 años
padre
commit
da6c3e4098

+ 3 - 8
packages/@uppy/core/src/UIPlugin.js

@@ -78,17 +78,12 @@ class UIPlugin extends BasePlugin {
         render(h(null), targetElement)
       }
 
-      // Since preact X the render function does not return a reference to the created element anymore.
-      // This is because it can sometimes return multiple elements now, likely due to fragments.
-      // To still get a reference in order to place it in `this.el`, we create a clone with a ref.
-      const ref = createRef()
-      const clone = cloneElement(this.render(this.uppy.getState()), { ref })
+      render(this.render(this.uppy.getState()), targetElement)
 
-      render(clone, targetElement)
-
-      this.el = ref.current
+      this.el = targetElement.firstElementChild
 
       this.onMount()
+
       return this.el
     }
 

+ 0 - 7
packages/@uppy/dashboard/src/components/VirtualList.js

@@ -93,13 +93,7 @@ class VirtualList extends Component {
   }
 
   handleScroll = () => {
-    const { sync } = this.props
-
     this.setState({ offset: this.base.scrollTop })
-
-    if (sync) {
-      this.forceUpdate()
-    }
   }
 
   handleResize = () => {
@@ -121,7 +115,6 @@ class VirtualList extends Component {
     rowHeight,
     renderRow,
     overscanCount = 10,
-    sync,
     ...props
   }) {
     const { offset, height } = this.state