Skip to content

Commit 375c441

Browse files
committed
Merge branch 'master' into perf-improvements-3
2 parents 10331d9 + 6a0bec2 commit 375c441

File tree

7 files changed

+42
-15
lines changed

7 files changed

+42
-15
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
name: Build & Test
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
1919
with:
20-
node-version: '14.x'
20+
node-version: 18
2121
- name: Cache node modules
22-
uses: actions/cache@v1
22+
uses: actions/cache@v3
2323
env:
2424
cache-name: cache-node-modules
2525
with:

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout Repo
14-
uses: actions/checkout@master
14+
uses: actions/checkout@v3
1515
with:
1616
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0
1818

19-
- name: Setup Node.js 14.x
20-
uses: actions/setup-node@master
19+
- name: Setup Node.js 18.x
20+
uses: actions/setup-node@v3
2121
with:
22-
node-version: 14.x
22+
node-version: 18
2323

2424
- name: Cache node modules
25-
uses: actions/cache@v1
25+
uses: actions/cache@v3
2626
env:
2727
cache-name: cache-node-modules
2828
with:

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact",
3333
"copy-typescript-definition": "copyfiles -f src/*.d.ts dist",
3434
"test": "eslint src test && tsc && npm run test:mocha && npm run test:mocha:compat && npm run test:mocha:debug && npm run bench",
35-
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/**/[!compat][!debug]*.test.js",
36-
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/compat.test.js 'test/compat-*.test.js'",
37-
"test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/debug.test.js 'test/debug-*.test.js'",
35+
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/*.test.js",
36+
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/compat.test.js 'test/compat/index.test.js'",
37+
"test:mocha:debug": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/debug.test.js 'test/debug/index.test.js'",
3838
"format": "prettier src/**/*.{d.ts,js} test/**/*.js --write",
3939
"prepublishOnly": "npm run build",
4040
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ function _renderToString(vnode, context, isSvgMode, selectValue, parent) {
348348

349349
if (afterDiff) afterDiff(vnode);
350350
vnode[PARENT] = undefined;
351+
if (options.unmount) options.unmount(vnode);
351352

352353
// Emit self-closing tag for empty void elements:
353354
if (!html) {

test/compat.test.js renamed to test/compat/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import render from '../src';
1+
import render from '../../src';
22
import { createElement } from 'preact/compat';
33
import { expect } from 'chai';
44

test/debug/index.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import 'preact/debug';
2+
import { render } from '../../src';
3+
import { h } from 'preact';
4+
import { expect } from 'chai';
5+
6+
describe('debug', () => {
7+
it('should not throw "Objects are not valid as a child" error', () => {
8+
expect(() => render(<p>{'foo'}</p>)).not.to.throw();
9+
expect(() => render(<p>{2}</p>)).not.to.throw();
10+
expect(() => render(<p>{true}</p>)).not.to.throw();
11+
expect(() => render(<p>{false}</p>)).not.to.throw();
12+
expect(() => render(<p>{null}</p>)).not.to.throw();
13+
expect(() => render(<p>{undefined}</p>)).not.to.throw();
14+
});
15+
16+
it('should not throw "Objects are not valid as a child" error #2', () => {
17+
function Str() {
18+
return ['foo'];
19+
}
20+
expect(() => render(<Str />)).not.to.throw();
21+
});
22+
23+
it('should not throw "Objects are not valid as a child" error #3', () => {
24+
expect(() => render(<p>{'foo'}bar</p>)).not.to.throw();
25+
});
26+
});

0 commit comments

Comments
 (0)