Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix widget autoHeight related exception #3858

Merged
merged 1 commit into from
May 31, 2019
Merged

Fix widget autoHeight related exception #3858

merged 1 commit into from
May 31, 2019

Conversation

ranbena
Copy link
Contributor

@ranbena ranbena commented May 31, 2019

  • Bug Fix

Description

Fixes #3857.

The error is due to 2 bugs in the autoHeight code:

  1. When resizing a non-autoheight widget, it gets added as a removed widget.
    Fixed by filtering it out:
    remove = (id) => {
      if (!this.widgets[id]) {
        return;
      }
  2. When detecting height change, already removed widgets aren't filtered out. Since removed widgets have a value of false, the array deconstruction generated the js error:
    Object.keys(this.widgets).forEach((id) => {
    const [getHeight, prevHeight] = this.widgets[id];

    Fixed by filtering it out:
    Object
       .keys(this.widgets)
       .filter(id => !!this.widgets[id])

Testing

The feature has e2e coverage so it's safe.

@ranbena ranbena self-assigned this May 31, 2019
@ranbena ranbena merged commit 0445340 into master May 31, 2019
@ranbena ranbena deleted the fix-autoheight branch May 31, 2019 11:57
@ranbena ranbena mentioned this pull request May 31, 2019
1 task
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS error on widget resize
2 participants