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.

`l` is not a function (reported from

See original GitHub issue

Describe the bug

Sentry Issue: CAMUNDA-MODELER-8P0

TypeError: l is not a function
  at apply (./src/shared/ui/overlay/OverlayDropdown.js:62:10)
...
(11 additional frame(s) were not displayed)

We don’t pass onClose in start instance:

         <OverlayDropdown
           title="Start current diagram"
           className={ classNames(css.StartInstanceTool, { 'btn--active': this.state.activeButton }) }
           items={ this.START_ACTIONS }
           buttonRef={ this.anchorRef }
           overlayState={ this.state.activeButton }
         >

Steps to reproduce

https://user-images.githubusercontent.com/28307541/177513557-743d7490-ff06-4ee9-8ed6-f4822aea87c7.mov

  1. Open start instance
  2. Click the button again

Expected behavior

No error

Environment

  • OS: [e.g. MacOS 10.2, Windows 10]
  • Camunda Modeler Version: [e.g. 2.0.0]
  • Execution Platform: [e.g. Camunda Platform, Camunda Cloud]
  • Installed plug-ins: […]

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Skaiircommented, Jul 6, 2022

@nikku @barmac For visibility

1reaction
Skaiircommented, Jul 6, 2022

Following some investigations, I’ll leave this in the state that it following RCA.


What happens

  1. We make use of a component called OverlayDropdown in different places in the application

  2. OverlayDropdown holds multiple different responsibilities

  • It’s a visual component to display groupings (ref1, ref2)
  • It handles the logic for displaying or not of the overlay based on either
    • A shouldOpen state variable as is the case with CreateNewAction to force it open externally
    • Internal state management, which involves multiple different functions
    • Internal messaging to external state management, using the onClose hook, which then is used to close the component externally.
  1. StartInstanceTool is using both OverlayDropdown, as well as StartInstanceConfigOverlay for the second step. It attaches that second overlay into the button that OverlayDropdown provides to position itself.

  2. The overlay displaying state management logic ends up shared between StartInstanceTool and OverlayDropdown, leading to hard to predict behavior.


The main issues

  • State is handled all over the place, it should be central.
  • We are breaking hierarchy by trying to add a second overlay to OverlayDropdown, which makes the code hard to read and hard to predict.
  • There are too many different ways of using OverlayDropdown, which again contributes to issues in readability and predictability.

Proposal

Right now, the only fix I could provide would be to make the OverlayDropdown a little more fault tolerant. But IMO the problem lies in how the whole component works, not our implementation of it. My fix would remove the exception, but actually this exception isn’t visible to the user in the first place, so it would be a monkey-patch only to make the debugger less red.

In my view, this section is simply in need of a refactor.

What I would do, is separate out the toggling buttons and state management logic from the visual logic OverlayDropdown provides. We could then actually compose more complex overlay and handle state management in one place safely.

This could be a good topic for a spring cleaning or slack time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >
JavaScript: Uncaught TypeError: n is not a function
Uncaught TypeError: 'n' is not a function: This is a standard JavaScript error when trying to call a function before it is defined....
Read more >
JavaScript error: "is not a function" - Stack Overflow
It was attempted to call a value like a function, but the value is not actually a function. Some code expects you to...
Read more >
l.select(...).done is not a function error is thrown when delete ...
Hi @jivanova, I've this problem with a kendoMultiSelect widget. Selection of an item from the dropdown menu; Blur of kendoDropDownList widget ...
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