Skip to content

Commit d4fddeb

Browse files
committed
fix: skip symbol elements
1 parent 843f4da commit d4fddeb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ValueObject } from "tuplerone";
44
const keyFilter = ([key]) => !key.startsWith("_");
55
export const createValueElement = (type, props, ...children) => {
66
const element = createElement(type, props, ...children);
7-
if (typeof type === "string") {
7+
if (typeof type === "string" || typeof type === "symbol") {
88
return element;
99
}
1010
return ValueObject(element, keyFilter);

src/index.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { createValueElement } from "../src";
22
import { shallow } from "tuplerone";
3+
import { ValueObject } from "tuplerone";
34

45
describe("createValueElement", () => {
56
it("works with props", () => {
6-
const c = () => null;
7-
const el1 = createValueElement(c, { a: { b: 1 } });
8-
const el2 = createValueElement(c, { a: { b: 1 } });
7+
const el1 = createValueElement(Function, { z: { b: 1 } });
8+
const el2 = createValueElement(Function, { z: { b: 1 } });
99

1010
expect(el1).toBe(el2);
11+
expect(el1.props).toBe(el2.props);
1112
});
1213

1314
it("handles circular references", () => {

0 commit comments

Comments
 (0)