1

Got the following code

import Rails from 'rails-ujs'
import _ from 'underscore'

export default class Ajax {
  static post(url, payload, success, error = () => {}, context = {}) {
    Rails.ajax({
      url: url,
      data: payload,
      type: 'post',
      success: success.bind(context),
      error: error.bind(context)
    })
  }
}

the post method works as expected on dev env, once code gets minified, success callback is called twice per one call. How can I understand why it happens ?

I'm 99% sure this is the issue, cause If I wrap the success.bind with _.once, callback is called only once.

Using uglifier gem version 4.1.20 with harmony:true option

Chen Kinnrot
  • 20,609
  • 17
  • 79
  • 141
  • Debugging minfified code can be a pain but Chrome dev tools has the ability to prettify the code. The variable names a still the same but it puts the new lines back in. May make debugging easier viewing the callstack to see what is going on. – ste2425 Dec 12 '19 at 09:53

1 Answers1

0

https://github.com/getsentry/sentry-javascript/issues/2340

Sentry issue, be aware, not related to compression, just not use sentry on dev..

Chen Kinnrot
  • 20,609
  • 17
  • 79
  • 141