Skip to content

Commit

Permalink
Clear resolved Vite instance (via Facade) to avoid memory-leak (#993)
Browse files Browse the repository at this point in the history
fixes #992

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone authored Feb 10, 2025
1 parent aaa2f46 commit 7bff823
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Concerns/ProvidesDefaultConfigurationOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static function prepareApplicationForNextOperation(): array
\Laravel\Octane\Listeners\PrepareLivewireForNextOperation::class,
\Laravel\Octane\Listeners\PrepareScoutForNextOperation::class,
\Laravel\Octane\Listeners\PrepareSocialiteForNextOperation::class,
\Laravel\Octane\Listeners\PrepareViteForNextOperation::class,
];
}

Expand Down
19 changes: 19 additions & 0 deletions src/Listeners/PrepareViteForNextOperation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Laravel\Octane\Listeners;

use Illuminate\Foundation\Vite;
use Illuminate\Support\Facades\Facade;

class PrepareViteForNextOperation
{
/**
* Handle the event.
*
* @param mixed $event
*/
public function handle($event): void
{
Facade::clearResolvedInstance(Vite::class);
}
}

0 comments on commit 7bff823

Please sign in to comment.