ngx-file-drop icon indicating copy to clipboard operation
ngx-file-drop copied to clipboard

Dropping files prevents ApplicationRef.isStable

Open Guy-Incognito opened this issue 5 years ago • 3 comments

As soon as a file is dropped (or selected via the file selector), ApplicationRef.isStable is always false.

I'm guessing it has something to do with the timer you are using: https://github.com/georgipeltekov/ngx-file-drop/blob/8609873dc0c0ad39f208d5a72c4570b10b39b396/src/lib/ngx-drop/file-drop.component.ts#L197

See: https://angular.io/api/core/ApplicationRef#is-stable-examples

Guy-Incognito avatar May 22 '19 07:05 Guy-Incognito

@georgipeltekov I can fix this issue using this approach. Is PR welcome?

maxkuzmin avatar Aug 05 '19 23:08 maxkuzmin

@maxkuzmin sure, be my guest :)

georgipeltekov avatar Aug 06 '19 05:08 georgipeltekov

@georgipeltekov actually, it seems like the issue is not angular zone related. I have revealed that after dragging file/files to drop zone timer(200, 200) starts looping, but never stops. Is there any way to stop it without significant code changing? For example, can we stop it after emitting value? Or can single timer stream emit more then one array of files (seems like no, another array will be emitted by new timer stream, created by new checkFiles call)

maxkuzmin avatar Aug 06 '19 20:08 maxkuzmin

I'm late to the party, but this is expected behavior of ApplicationRef.isStable. When there is any open Observable in your application, it will never be considered as stable, see the docs. Whatever you are trying to do, you should not rely on ApplicationRef.isStable. Maybe ApplicationInitStatus.donePromise is a good alternative for you.

json-derulo avatar May 05 '23 12:05 json-derulo