Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit bce404c

Browse files
committed
improvement: allow plugin to be used in recurring mode
1 parent feb15a2 commit bce404c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

npm-audit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h5 class="card-title">
5555
<div class="card">
5656
<div class="card-body">
5757
<h5 class="card-title">
58-
December 7th 2020, 9:26:48 am
58+
December 7th 2020, 9:31:53 am
5959
</h5>
6060
<p class="card-text">Last updated</p>
6161
</div>

src/Supercharged/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ export class Supercharged {
2929
/**
3030
* Plugin fn for edge
3131
*/
32-
public wire = (edge: Edge) => {
32+
public wire = (edge: Edge, firstRun: boolean) => {
33+
/**
34+
* Reset components on each run. The "discoverComponents"
35+
* calls will collect them
36+
*/
37+
this.components = {}
38+
3339
Object.keys(edge.loader.mounted).forEach((diskName) => {
3440
if (diskName === 'default') {
3541
this.discoverComponents(edge.loader.mounted[diskName])
@@ -41,6 +47,14 @@ export class Supercharged {
4147
}
4248
})
4349

50+
/**
51+
* Do not re-run the following code when it is a recurring
52+
* run
53+
*/
54+
if (!firstRun) {
55+
return
56+
}
57+
4458
/**
4559
* Claim tags registered with supercharged
4660
*/

0 commit comments

Comments
 (0)