Skip to content
This repository was archived by the owner on Dec 31, 2020. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mobxjs/mobx-react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.4.1
Choose a base ref
...
head repository: mobxjs/mobx-react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.4.2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 20, 2018

  1. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fc8fefb View commit details
  2. Published version 5.4.2

    mweststrate committed Nov 20, 2018
    Copy the full SHA
    a3e9d39 View commit details
Showing with 7 additions and 7 deletions.
  1. +1 −2 package.json
  2. +6 −5 src/observer.js
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-react",
"version": "5.4.1",
"version": "5.4.2",
"description": "React bindings for MobX. Create fully reactive components.",
"main": "index.js",
"jsnext:main": "index.module.js",
@@ -73,7 +73,6 @@
},
"dependencies": {
"hoist-non-react-statics": "^3.0.0",
"react-is": "^16.3.2",
"react-lifecycles-compat": "^3.0.2"
},
"keywords": [
11 changes: 6 additions & 5 deletions src/observer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React, { Component, PureComponent } from "react"
import React, { Component, PureComponent, forwardRef } from "react"
import hoistStatics from "hoist-non-react-statics"
// FIXME: This fails in rollup, sadly, as a full import is bigger :-(
// import { ForwardRef } from "react-is"
import * as ReactIs from "react-is"
import { createAtom, Reaction, _allowStateChanges, $mobx } from "mobx"
import { findDOMNode as baseFindDOMNode } from "react-dom"

@@ -29,6 +26,10 @@ export const renderReporter = new EventEmitter()
const skipRenderKey = newSymbol("skipRender")
const isForcingUpdateKey = newSymbol("isForcingUpdate")

// Using react-is had some issues (and operates on elements, not on types), see #608 / #609
const ReactForwardRefSymbol =
typeof forwardRef === "function" && forwardRef((_props, _ref) => {})["$$typeof"]

/**
* Helper to set `prop` to `this` as non-enumerable (hidden prop)
* @param target
@@ -325,7 +326,7 @@ export function observer(arg1, arg2) {
// Unwrap forward refs into `<Observer>` component
// we need to unwrap the render, because it is the inner render that needs to be tracked,
// not the ForwardRef HoC
if (componentClass["$$typeof"] === ReactIs.ForwardRef) {
if (ReactForwardRefSymbol && componentClass["$$typeof"] === ReactForwardRefSymbol) {
const baseRender = componentClass.render
if (typeof baseRender !== "function")
throw new Error("render property of ForwardRef was not a function")