label-studio icon indicating copy to clipboard operation
label-studio copied to clipboard

Label Studio Editor not destroying cleanly

Open kartikwatwani opened this issue 1 year ago • 2 comments

Describe the bug LabelStudio.destroyAll or instance.destroy function of Label studio frontend editor is not destroying properly which is causing problems when trying to render app again in angular app.

To Reproduce Steps to reproduce the behavior:

  1. In an angular app load the script dynamically when the component is to be used.
  2. After window.LabelStudio is available, create a new instance of label studio binded to div with any id and save it in component property say labelStudioInstance. The editor will show up.
  3. Now in ngOnDestroy call window.LabelStudio.destroyAll or this.labelStudioInstance.destroy()
  4. Now go to some other component so ngOnDestroy is called and come back to the same component that shows label studio editor.

Now the console will show below errors and not render the editor.

zone.js:1155 Uncaught 
Error: MobX Provider: The set of provided stores has changed. See: https://github.com/mobxjs/mobx-react#the-set-of-provided-stores-has-changed-error.
    at Provider (main.js:113378:13)
    at renderWithHooks (main.js:196256:18)
    at updateFunctionComponent (main.js:198627:20)
    at beginWork (main.js:200334:16)
    at HTMLUnknownElement.callCallback (main.js:185216:14)
    at _ZoneDelegate.invokeTask (zone.js:398:33)
    at ZoneImpl.runTask (zone.js:158:47)
    at ZoneTask.invokeTask [as invoke] (zone.js:479:34)
    at invokeTask (zone.js:1105:18)
    at globalCallback (zone.js:1136:29)
The above error occurred in the <MobXProvider> component:

    at Provider (http://localhost:4200/assets/main.js:113366:24)
    at div
    at http://localhost:4200/assets/main.js:303159:5
    at App (http://localhost:4200/assets/main.js:259151:5)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

Expected behavior After coming back to the component, the editor should render and the MobxProvider error should not come up.

Environment (please complete the following information):

  • OS: macOS
  • Label Studio Version 1.12.1

kartikwatwani avatar Jul 01 '24 20:07 kartikwatwani

/jira create

Workflow run Jira issue TRIAG-765 is created

jombooth avatar Aug 01 '24 05:08 jombooth

Hi @kartikwatwani, thanks for this report! We'll investigate on our end.

jombooth avatar Aug 01 '24 05:08 jombooth