Skip to content

Commit

Permalink
fix: ssr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed Mar 26, 2019
1 parent 941dc2e commit d781184
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/react-dnd/src/DragPreviewImage.tsx
Expand Up @@ -10,9 +10,11 @@ interface DragPreviewImageProps {
*/
const DragPreviewImage: React.FC<DragPreviewImageProps> = React.memo(
({ connect, src }) => {
const img = new Image()
img.src = src
img.onload = () => connect(img)
if (typeof Image !== 'undefined') {
const img = new Image()
img.src = src
img.onload = () => connect(img)
}
return null
},
)
Expand Down
4 changes: 3 additions & 1 deletion packages/react-dnd/src/decorateHandler.tsx
Expand Up @@ -202,7 +202,9 @@ export default function decorateHandler<Props, CollectedProps, ItemIdType>({
<Consumer>
{({ dragDropManager }) => {
this.receiveDragDropManager(dragDropManager)
requestAnimationFrame(() => this.handlerConnector!.reconnect())
if (typeof requestAnimationFrame !== 'undefined') {
requestAnimationFrame(() => this.handlerConnector!.reconnect())
}
return (
<Decorated
{...this.props}
Expand Down

0 comments on commit d781184

Please sign in to comment.