8000 bug #964 [StimulusBundle] Fixing bug where new custom controllers wer… · symfony/ux@6ee3f52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ee3f52

Browse files
committed
bug #964 [StimulusBundle] Fixing bug where new custom controllers were 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
2 parents ddb6485 + 4503e3d commit 6ee3f52

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/StimulusBundle/src/AssetMapper/ControllersMapGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public function getControllersJsonPath(): string
4848
return $this->controllersJsonPath;
4949
}
5050

51+
public function getControllerPaths(): array
52+
{
53+
return $this->controllerPaths;
54+
}
55+
5156
/**
5257
* @return array<string, MappedControllerAsset>
5358
*/

src/StimulusBundle/src/AssetMapper/StimulusLoaderJavaScriptCompiler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ public function compile(string $content, MappedAsset $asset, AssetMapperInterfac
4343
$eagerControllerParts = [];
4444
$lazyControllers = [];
4545
$loaderPublicPath = $asset->publicPathWithoutDigest;
46+
47+
// add file dependencies so the cache rebuilds
4648
$asset->addFileDependency($this->controllersMapGenerator->getControllersJsonPath());
49+
foreach ($this->controllersMapGenerator->getControllerPaths() as $controllerDir) {
50+
$asset->addFileDependency($controllerDir);
51+
}
52+
4753
foreach ($this->controllersMapGenerator->getControllersMap() as $name => $mappedControllerAsset) {
4854
$controllerPublicPath = $mappedControllerAsset->asset->publicPathWithoutDigest;
4955
$relativeImportPath = $this->createRelativePath($loaderPublicPath, $controllerPublicPath);

0 commit comments

Comments
 (0)
0