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.

Error when rendering JS interop component

See original GitHub issue

Hi

Im trying to create an interop for this Button component (https://atlaskit.atlassian.com/packages/core/button). I can create facades for other components successfully, but I have no clue why this one failed. I tried to debug for a few hours, but I can’t seem to find a solution.

Its just a very simple component, equivalent in JS

import Button from "@atlaskit/button"

<Button>Click Here</Button>

My scala js interop

object Button {

  @JSImport("@atlaskit/button", JSImport.Default)
  @js.native
  object RawComponent extends js.Object

  val component = JsComponent[Null, Children.Varargs, Null](RawComponent)
}

got an error

Uncaught TypeError: Cannot read property 'ctor__Ljapgolly_scalajs_react_CtorType' of null

I’ve created a small project to replicate the problem here (https://github.com/allantl/scala-js-interop)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
japgollycommented, Aug 31, 2018

That’s great to know, thanks for sharing. This will be resolved in the next release.

Speaking of which, I meant to have the next release down by now but life popped up and I was preparing for a talk which I gave at an FP conference just this week (yay). I should have some more free time again now so I’ll be focusing on scalajs-react again as my main priority. Soon…

And thanks for the feedback, I’m very happy to hear that you’re enjoying the library. Cheers

0reactions
allantlcommented, Aug 21, 2018

@japgolly FYI, I’ve found out why the component doesn’t work. The library exposes the component in React.forwardRef.

screen shot 2018-08-22 at 01 26 32

In JS,

<Button>Click Here</Button>

will render successfully, even though no ref is passed.

I guess I’ll be waiting for this to be supported. Thanks for the good work so far!

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net core - JavaScript interop Error when calling javascript ...
JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendererd. When prerendering is ...
Read more >
JSException in WebAssemblyRenderer · Issue #21874 - GitHub
That typically means the error is being thrown while processing the view code, or when you've modified the DOM with JS and it...
Read more >
JavaScript Errors - Telerik UI for Blazor
Sometimes, the JS Interop file is referenced correctly and returns successfully, but occasionally you get the error. This indicates a timing issue (for...
Read more >
Using JSInterop to Pass HTML Elements and Handle JS Errors
In this article, we are going to learn about using JsInterop to pass HTML elements to the JS functions and how to handle...
Read more >
Prerender and integrate ASP.NET Core Razor components
Razor components can be integrated into Razor Pages and MVC apps. When the page or view is rendered, components can be prerendered at...
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