Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function diff(
c._nextState,
componentContext
) === false) ||
newVNode._original == oldVNode._original
newVNode._original == oldVNode._original
) {
// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8
if (newVNode._original != oldVNode._original) {
Expand Down Expand Up @@ -369,7 +369,11 @@ export function commitRoot(commitQueue, root, refQueue) {
}

function cloneNode(node) {
if (typeof node != 'object' || node == NULL) {
if (
typeof node != 'object' ||
node == NULL ||
(node._depth && node._depth > 0)
) {
return node;
}

Expand Down Expand Up @@ -531,8 +535,7 @@ function diffElementNodes(
if (
!isHydrating &&
(!oldHtml ||
(newHtml.__html != oldHtml.__html &&
newHtml.__html != dom.innerHTML))
(newHtml.__html != oldHtml.__html && newHtml.__html != dom.innerHTML))
) {
dom.innerHTML = newHtml.__html;
}
Expand Down
31 changes: 31 additions & 0 deletions test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1996,4 +1996,35 @@ describe('render()', () => {
render(<App y="2" />, scratch);
expect(actions).to.deep.equal(['mounted 1', 'mounted 2', 'mounted 3']);
});

it('Should render intercepted component', () => {
class Test {
constructor(text) {
this.text = text;
}
}

const TestValue = props => {
return props.text;
};

Object.defineProperties(Test.prototype, {
constructor: { configurable: true, value: undefined },
type: { configurable: true, value: TestValue },
props: {
configurable: true,
get() {
return { text: this.text };
}
},
_depth: { configurable: true, value: 1 }
});

const test = new Test('hello world');

const App = () => <Fragment>{test}</Fragment>;

render(<App />, scratch);
expect(scratch.innerHTML).to.equal('hello world');
});
});
Loading