Inferno: componentToDOMNodeMap is empty in 1.0.3 (works in 1.0.2)

Created on 31 Dec 2016  路  11Comments  路  Source: infernojs/inferno

Observed Behaviour
findDOMNode is not returning any dom-node for the requested component.

After updating from 1.0.2 to 1.0.3 the findDOMNode from here did not work any more because the componentToDOMNodeMap seems to be empty now - my own components still work, but I'm using react-grid-layout (through inferno-compat), which uses findDOMNode internally and does not work correctly any more.
I've double-checked: When downgrading to 1.0.2 everything works as expected and componentToDOMNodeMap contains all the components & elements.

Expected Current Behaviour
findDOMNode should return dom-nodes for requested react-components that are implemented via inferno-compat.

Inferno Metadata
[email protected]
Windows 10
Chrome 55


Anyways: A little shoutout to the maintainer(s): Keep up the amazing work, it's awesome to see so many updates & improvements on an hourly basis!

bug to verify

All 11 comments

Hey @olsn, any chance you can throw together a repo or fiddle to illustrate this? You can use this as a starter. Makes it much easier to pinpoint :)

Hey,

Can you make sure you have findDOMNodeEnabled true.

Just to note, this is done off options now:

https://github.com/infernojs/inferno#options-package-inferno

Inferno.options.findDOMNodeEnabled = true

It did not throw an error, so I assumed that it was turned on, but I will verify it in a minute - regarding the code - I can push the whole snapshot to a public github repo later.

Update: The option was turned on already, this is my options-object:

{
    "recyclingEnabled": true,
    "findDOMNodeEnabled": false,
    "roots": ["...Array with length 1 containing my one root 'div#app'..."],
    "createVNode": null,
    "beforeRender": null,
    "afterRender": null,
    "afterMount": null,
    "afterUpdate": null,
    "beforeUnmount": null
}

Update#2: I'm just seeing that is says "false" - but event after using Inferno.options.findDOMNodeEnabled = true it did not change anything

Update#3: When it is called from the react-component, it is definitely set to true (regardless of me setting it to true manually or not, what I've seen in the code is, that this is done my inferno-compat:

image

Update#4: What I also noticed is, that enableFindDOMNode() is metioned in the d.ts-file and the error-message(which is not thrown) but I did not find an implmentation of it in the dist-files.

Seems like a regression then. Once we can see your repo, we can squash this bug before releasing 1.0.4 @Havunen

I've pushed it here: https://github.com/olsn/nongrx-example-app
My current package.json contains 1.0.3 but when you downgrade to 1.0.2 the dragging-/resizing-features from react-grid-layout will work just fine.

Is there an _easy_ way to use inferno-compat in an jsfiddle? Then I could maybe publish a fiddle next time, it might be easier to check for a bug in a live version directly.

This should be fixed in the latest version 1.0.6

This should be fixed. Closing ticket. Reopen if you still experience issue with this.

Just installed the latest version, works perfectly.
Awesome, thx! 馃憤

@trueadm @Havunen
Guys, I have same error in inferno 3.0.6 I am working on https://github.com/kurdin/inferno-animate-css and I need find DOM node where to apply animation classes. Everything works on my local demo page, same inferno 3.0.6 but when I import Animate component in my real application componentToDOMNodeMap is empty and any node is null.
Inferno.options.findDOMNodeEnabled is true

in code:

      <Animate appear="fadeInDown">
        <h3>inferno <a href="http://daneden.github.io/animate.css/">animate.css</a></h3>
      </Animate>

```
var InfernoCSSTransitionGroupChild = Inferno.createClass({
displayName: 'InfernoCSSTransitionGroupChild',
....
transition: function transition(animationType, finishCallback, userSpecifiedDelay) {
var node = Inferno.findDOMNode(this); // will return null
}
....
````

screen shot 2017-04-27 at 5 05 33 pm

any ideas?

no idea, steps to reproduce needed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aprilmintacpineda picture aprilmintacpineda  路  22Comments

thepian picture thepian  路  20Comments

vinej picture vinej  路  24Comments

AlgoTrader picture AlgoTrader  路  54Comments

ilyaigpetrov picture ilyaigpetrov  路  21Comments