plotly / plotly/angular-plotly.js

TypeError: PlotlyService.plotly.purge is not a function

Aperta
#180 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
TypeScript
Stelle
242
Fork
81
Merge medio
8h 48m
PR unite (30g)
18

Descrizione

Getting this error when switching active submodules

core.js:6486 ERROR Error: Uncaught (in promise): TypeError: PlotlyService.plotly.purge is not a function
TypeError: PlotlyService.plotly.purge is not a function
    at Function.remove (:4200/default-src_app_service_comp-reg_service_ts.js:25186)
    at PlotlyComponent.ngOnDestroy (:4200/default-src_app_service_comp-reg_service_ts.js:25348)
    at executeOnDestroys (:4200/vendor.js:32351)
    at cleanUpView (:4200/vendor.js:32254)
    at destroyViewTree (:4200/vendor.js:32080)
    at destroyLView (:4200/vendor.js:32232)
    at RootViewRef.destroy (:4200/vendor.js:47596)
    at ComponentRef$1.destroy (:4200/vendor.js:50130)
    at RouterOutlet.deactivate (:4200/vendor.js:93334)
    at ActivateRoutes.deactivateRouteAndOutlet (:4200/vendor.js:89858)
    at resolvePromise (:4200/polyfills.js:1222)
    at resolvePromise (:4200/polyfills.js:1176)
    at :4200/polyfills.js:1288
    at ZoneDelegate.invokeTask (:4200/polyfills.js:415)
    at Object.onInvokeTask (:4200/vendor.js:53612)
    at ZoneDelegate.invokeTask (:4200/polyfills.js:414)
    at Zone.runTask (:4200/polyfills.js:187)
    at drainMicroTaskQueue (:4200/polyfills.js:591)
defaultErrorLogger @ core.js:6486

Submodule config:

...
import { PlotlyViaCDNModule } from 'angular-plotly.js';

PlotlyViaCDNModule.setPlotlyVersion('latest');
PlotlyViaCDNModule.setPlotlyBundle('finance');

@NgModule({
  declarations: [
    DcComponent,
    DcChartComponent,
    ...
  ],
  imports: [
    CommonModule,
    DcRoutingModule,
    ...
    PlotlyViaCDNModule,
    ...
  ]
  ...
}
export class DcModule { }

Note that the scenario is that the Plotly Data Card is configured and saved in one module, then dynamically loaded and displayed in another module. The error occurs sometimes when switching contexts (modules). I guess when the second by loading order is first loaded.

Env:

$ npm list angular-plotly.js
...
└── angular-plotly.js@4.0.4 
$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.2.12
Node: 14.17.0
Package Manager: npm 7.20.5
OS: linux x64

Angular: 12.2.12
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.12
@angular-devkit/build-angular   12.2.12
@angular-devkit/core            12.2.12
@angular-devkit/schematics      12.2.12
@angular/flex-layout            12.0.0-beta.35
@schematics/angular             12.2.12
rxjs                            6.6.7
typescript                      4.3.5
    

Thanks.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo lo scenario di commutazione dinamica dei moduli, quindi traccia PlotlyComponent.ngOnDestroy e PlotlyService.plotly.purge in angular-plotly.js. Confronta come PlotlyViaCDNModule viene configurato e caricato nei due moduli; il lavoro è completato quando il cambio di contesto non genera più un purge TypeError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.