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.3
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.4
Choose a head ref
  • 12 commits
  • 6 files changed
  • 7 contributors

Commits on Dec 5, 2018

  1. Verified

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

Commits on Dec 11, 2018

  1. Cache newSymbol created Symbols

    The observer decorator created 2 Symbols for each decorated component
    instead of reusing the Symbols for props and state that was previously
    created
    normano64 committed Dec 11, 2018
    2
    Copy the full SHA
    98396f0 View commit details

Commits on Dec 12, 2018

  1. Copy the full SHA
    68f92ac View commit details

Commits on Dec 13, 2018

  1. Copy the full SHA
    7266e1a View commit details

Commits on Dec 20, 2018

  1. Merge pull request #623 from jamonholmgren/patch-1

    Adds Ignite Bowser boilerplate to README
    mweststrate authored Dec 20, 2018
    Copy the full SHA
    312070a View commit details
  2. Merge pull request #622 from normano64/cache-symbols

    Cache newSymbol created Symbols
    mweststrate authored Dec 20, 2018
    Copy the full SHA
    34b34db View commit details
  3. Merge pull request #618 from fi3ework/master

    feat: add version to built file (resolve #610)
    mweststrate authored Dec 20, 2018
    Copy the full SHA
    02040b0 View commit details

Commits on Jan 10, 2019

  1. Fix typo!

    Duplicate `use`.
    henning-kvinnesland authored Jan 10, 2019
    Copy the full SHA
    e54e10e View commit details

Commits on Jan 18, 2019

  1. Copy the full SHA
    75274c8 View commit details

Commits on Jan 21, 2019

  1. Copy the full SHA
    55eeb96 View commit details

Commits on Feb 11, 2019

  1. Merge pull request #632 from WearyMonkey/WearyMonkey-patch-1

    Fix disposeOnUmount typo in README.md
    mweststrate authored Feb 11, 2019
    Copy the full SHA
    1e8d6b5 View commit details

Commits on May 16, 2019

  1. Published version 5.4.4

    mweststrate committed May 16, 2019
    Copy the full SHA
    20ed293 View commit details
Showing with 44 additions and 8 deletions.
  1. +3 −2 README.md
  2. +21 −1 build-rollup.js
  3. +1 −1 package.json
  4. +2 −3 publish.js
  5. +9 −1 src/utils/utils.js
  6. +8 −0 test/{no-symbol.test.js → symbol.test.js}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ If you are using [React hooks](https://reactjs.org/docs/hooks-intro.html) with l
* Minimal MobX, React, ES6(babel), JSPM with hot reloading modules:
[jspm-react](https://github.com/capaj/jspm-react)
* React Native Counter: [Mobx-React-Native-Counter](https://github.com/bartonhammond/mobx-react-native-counter)
* React Native, TypeScript, React Navigation: [Ignite Bowser](https://github.com/infinitered/ignite-bowser)

## API documentation

@@ -201,7 +202,7 @@ class TodoView extends React.Component {
```

* `componentWillReact` doesn't take arguments
* `componentWillReact` won't fire before the initial render (use use `componentDidMount` or `constructor` instead)
* `componentWillReact` won't fire before the initial render (use `componentDidMount` or `constructor` instead)

### `PropTypes`

@@ -441,7 +442,7 @@ class SomeComponent extends React.Component {
disposeOnUnmount(this, reaction(...))

// or function array
disposeOnUmount(this, [
disposeOnUnmount(this, [
reaction(...),
reaction(...)
])
22 changes: 21 additions & 1 deletion build-rollup.js
Original file line number Diff line number Diff line change
@@ -6,11 +6,26 @@ var resolve = require("rollup-plugin-node-resolve")
var uglify = require("rollup-plugin-uglify").uglify
var alias = require("rollup-plugin-alias")
var replace = require("rollup-plugin-replace")
var buildVersion = require("./package.json").version

var { rollup } = require("rollup")

var emptyModulePath = path.resolve(__dirname, "empty.js")

var license = ` * Copyright (c) 2015 Michel Weststrate.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.`

function licenseWrapper(source, version, filename) {
return `/** @license mobx-react v${version}
* ${filename}
*
${license}
*/
${source}`
}

function getExternals(target) {
switch (target) {
case "browser":
@@ -47,7 +62,12 @@ function build(target, mode, filename) {
module: true,
main: true
}),
commonjs()
commonjs(),
{
transformBundle(source) {
return licenseWrapper(source, buildVersion, filename)
}
}
]

if (mode.endsWith(".min")) {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-react",
"version": "5.4.3",
"version": "5.4.4",
"description": "React bindings for MobX. Create fully reactive components.",
"main": "index.js",
"jsnext:main": "index.module.js",
5 changes: 2 additions & 3 deletions publish.js
Original file line number Diff line number Diff line change
@@ -35,9 +35,6 @@ async function prompt(question, defaultValue) {
}

async function main() {
// build
run("npm run build")

const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"))

// Bump version number
@@ -68,6 +65,8 @@ async function main() {

fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2), "utf8")

// build
run("npm run build")
// Finally, commit and publish!
run("npm publish")
run(`git commit -am "Published version ${version}"`)
10 changes: 9 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ export function isStateless(component) {
}

let symbolId = 0
export function newSymbol(name) {
function createSymbol(name) {
if (typeof Symbol === "function") {
return Symbol(name)
}
@@ -14,6 +14,14 @@ export function newSymbol(name) {
return symbol
}

const createdSymbols = {}
export function newSymbol(name) {
if (!createdSymbols[name]) {
createdSymbols[name] = createSymbol(name)
}
return createdSymbols[name]
}

const mobxMixins = newSymbol("patchMixins")
const mobxPatchedDefinition = newSymbol("patchedDefinition")

8 changes: 8 additions & 0 deletions test/no-symbol.test.js → test/symbol.test.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ delete global.Symbol
import React, { Component } from "react"
import { observer } from "../src"
import { asyncReactDOMRender, createTestRoot } from "./"
import { newSymbol } from "../src/utils/utils"

const testRoot = createTestRoot()

@@ -16,3 +17,10 @@ test("work without Symbol", async () => {
)
await asyncReactDOMRender(<Component1 />, testRoot)
})

test("cache newSymbol created Symbols", () => {
const symbol1 = newSymbol("name")
const symbol2 = newSymbol("name")

expect(symbol1).toEqual(symbol2)
})