griffithlab / civic-client

Web client for CIViC: Clinical Interpretations of Variants in Cancer
MIT License
50 stars 28 forks source link

in advanced search, switching away from then back to a search condition throws error #994

Open jmcmichael opened 6 years ago

jmcmichael commented 6 years ago

To reproduce: Any any Adv. Search tab, select a search condition, select any other search condition, then re-select the initial search condition.

Note that the condition's template may not render properly and in the console an error is displayed:

"Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported."

This appears to be a regression of some kind with Angular v1.6. Based on this issue and this issue our code may still produce this error on the latest versions of ng. It's worth upgrading to see. There appear to be workarounds for other situations where this was encountered, but nothing exactly matching ours.

This error is thrown in the onChange function that is called when the condition select changes and resets the condition to default empty values:

onChange: function(value, options, scope) {
  scope.model.condition = {
    name: undefined,
    parameters: []
  };
}
jmcmichael commented 6 years ago

The error stack trace does not directly reference any CIViC code, and is thrown by something deep in angular-formly. Next option is to update to the latest version of the package. We're at 7.3.9, most recent version is 8.4.1 with a breaking change that looks like it will affect some CIViC functions.

kkrysiak commented 5 years ago

Is there anything where we could throw a warning to the user? hit the X and try again or something?

jmcmichael commented 5 years ago

That would be ideal, but this error occurs deep into the 'magic' of the angular framework in such a way that I can't capture it in a try/catch statement that would allow the client to detect an error and catch it in order to display a message to the user.

jmcmichael commented 4 years ago

After I refactor the dev/build workflow (next major task), I will update angular and all the components. Hopefully this will fix the problem or provide better debugging output. Currently I'm out of ideas on how to debug this.