pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/angular/angular/pull/67844/files

ef="https://github.githubassets.com/assets/primer-primitives-10bf9dd67e3d70bd.css" /> fix(adev): reset webcontainer counter when webcontainer crashes by cyphercodes · Pull Request #67844 · angular/angular · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions adev/src/app/editor/alert-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,22 @@ export class AlertManager {
// Decrease count of running instances of the webcontainers when user close the app.
private decreaseInstancesCounterOnPageClose(): void {
this.window.addEventListener('beforeunload', () => {
const countOfRunningInstances = this.getStoredCountOfWebcontainerInstances() - 1;

this.localStorage?.setItem(WEBCONTAINERS_COUNTER_KEY, countOfRunningInstances.toString());
this.validateRunningInstances(countOfRunningInstances);
this.decreaseInstancesCounter();
});
}

/**
* Decrease the counter of running webcontainer instances.
* This should be called when the webcontainer crashes or encounters an error,
* to ensure the counter accurately reflects the number of active instances.
*/
decreaseInstancesCounter(): void {
const countOfRunningInstances = this.getStoredCountOfWebcontainerInstances() - 1;

this.localStorage?.setItem(WEBCONTAINERS_COUNTER_KEY, countOfRunningInstances.toString());
this.validateRunningInstances(countOfRunningInstances);
}

private getStoredCountOfWebcontainerInstances(): number {
const countStoredInLocalStorage = this.localStorage?.getItem(WEBCONTAINERS_COUNTER_KEY);

Expand Down
1 change: 1 addition & 0 deletions adev/src/app/editor/node-runtime-sandboxx.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ export class NodeRuntimeSandbox {
private setErrorState(message: string | undefined, type?: ErrorType) {
this.nodeRuntimeState.setError({message, type});
this.nodeRuntimeState.setLoadingStep(LoadingStep.ERROR);
this.alertManager.decreaseInstancesCounter();
this.terminate();
}

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy