Skip to content

Commit

Permalink
bug #964 [StimulusBundle] Fixing bug where new custom controllers wer…
Browse files Browse the repository at this point in the history
…e not seen due to cache (weaverryan)

This PR was merged into the 2.x branch.

Discussion
----------

[StimulusBundle] Fixing bug where new custom controllers were not seen due to cache

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Tickets       | Fix #961
| License       | MIT

This requires symfony/symfony#50749

Cheers!

Commits
-------

4503e3d [StimulusBundle] Fixing bug where new custom controlles were not seen due to cache
  • Loading branch information
weaverryan committed Jun 26, 2023
2 parents ddb6485 + 4503e3d commit 6ee3f52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public function getControllersJsonPath(): string
return $this->controllersJsonPath;
}

public function getControllerPaths(): array
{
return $this->controllerPaths;
}

/**
* @return array<string, MappedControllerAsset>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ public function compile(string $content, MappedAsset $asset, AssetMapperInterfac
$eagerControllerParts = [];
$lazyControllers = [];
$loaderPublicPath = $asset->publicPathWithoutDigest;

// add file dependencies so the cache rebuilds
$asset->addFileDependency($this->controllersMapGenerator->getControllersJsonPath());
foreach ($this->controllersMapGenerator->getControllerPaths() as $controllerDir) {
$asset->addFileDependency($controllerDir);
}

foreach ($this->controllersMapGenerator->getControllersMap() as $name => $mappedControllerAsset) {
$controllerPublicPath = $mappedControllerAsset->asset->publicPathWithoutDigest;
$relativeImportPath = $this->createRelativePath($loaderPublicPath, $controllerPublicPath);
Expand Down

0 comments on commit 6ee3f52

Please sign in to comment.