summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-04-27 17:09:05 -0500
committerMike Greiling <mike@pixelcog.com>2018-05-01 15:15:11 -0500
commitb2d90ea1fb16ec4db441c86262191a093401b962 (patch)
treed15d51c3831c1bf485ee6b990b7af825af0a08a8
parentf9e33f43c0991930bb779c2a5ea341a41ba3a90f (diff)
downloadgitlab-ce-b2d90ea1fb16ec4db441c86262191a093401b962.tar.gz
ensure parent entrypoint is loaded if direct one is unavailable
-rw-r--r--app/helpers/webpack_helper.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb
index 2f556559c6b..30cd8c90008 100644
--- a/app/helpers/webpack_helper.rb
+++ b/app/helpers/webpack_helper.rb
@@ -15,12 +15,18 @@ module WebpackHelper
end
route = [*controller.controller_path.split('/'), action].compact
- entrypoint = "pages.#{route.join('.')}"
- begin
- chunks = entrypoint_paths(entrypoint, extension: 'js')
- rescue Gitlab::Webpack::Manifest::AssetMissingError
- # no bundle exists for this path
+ until chunks.any? || route.empty?
+ entrypoint = "pages.#{route.join('.')}"
+ begin
+ chunks = entrypoint_paths(entrypoint, extension: 'js')
+ rescue Gitlab::Webpack::Manifest::AssetMissingError
+ # no bundle exists for this path
+ end
+ route.pop
+ end
+
+ if chunks.empty?
chunks = entrypoint_paths("default", extension: 'js')
end