question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle null children exception

See original GitHub issue

Thanks for taking the time to file an issue with us. Please note that this issue template is used ONLY for reporting bugs.

If you have an issue that isn’t a bug, please follow the steps listed in the Contributing. Thanks!

Expected behavior

If you pass as a child a React Component which could be null, this causes an unexpected TypeError.

Current behavior

Observer is passed the null instance and a TypeError occurs

Steps to reproduce

  1. Create an IntersectionObserver as a HOC and pass in a React Component (Class or SFC, returning null) as the only child
  2. Observe that the observer attempts to attach to whatever the React Component returns; image

Context (environment)

This got past our CI pipeline because TypeScript (correctly) allows null as a valid return type from React.SFC or React.ReactNode. I will try to take a look and provide my own solution, but please also advise if this is due to a limitation within React or otherwise.

  • Version: “0.7.3”
  • Platform: OSX Debian

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Rendezcommented, Dec 11, 2018
1reaction
311289189commented, Oct 9, 2018

I will give it a shot in the next few days

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle null child Entities in MVC Razor - Stack Overflow
I have an MVC razor view that iterates over an Orders collection. Each order has a Customer, which can be null. Trouble is,...
Read more >
Handle NULL child elements in XML node - MSDN - Microsoft
I can see that the first grand child element is NULL. It throws 'object reference is not set to an instance of object'...
Read more >
Handling Nulls in nested objects (Java) - Lalit Vatsal - Medium
Handling NullPointerException and keeping track of all the nullable values has always been a pain for Java developers.
Read more >
attempt to de-reference null object when using maps to build ...
Is there a simple way to handle this null error when manually building this parent-child map? I expect that I will have many...
Read more >
Coroutine exceptions handling | Kotlin Documentation
Here we look at what happens if an exception is thrown during cancellation or multiple children of the same coroutine throw an exception....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found