Closed Ostrovyi closed 1 year ago
Hi @Ostrovyi,
I can see what you mean, but for what I've investigated the problem is not related to the injectStripe
function. If I add the StripeFactoryService
to my component's constructor and then create the instance using this.factory.create the same things happens. Even if I inject the StripeService and then assign the stripe instance to a variable in the component, I get the exact same behaviour.
I don't have much experience myself with the DoCheck lifecycle hook myself, but I guess it might be because once you inject one of these services the library has to download StripeJS and attached to DOM? I'm just speculating, really no idea.
If you have any suggestions about what the reason could be or what kind of changes we can do to prevent it I'm more that happy to dig into this. Of course, a PR is always welcome.
Kind regards
R
I'm closing this due to inactivity
Import stripe service in component or another service:
import {StripeService} from 'ngx-stripe';
Inject it:private stripeService = inject(StripeService);
Open Angular extension in Developer Tools, section Profiler. Click start record. Or in app.component place this function:You will see that change detection triggers multiple times.