-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(SSR): explicitly load KtNavbar as a component
A change in the template of NavBar.vue produced a very hard to trace down bug which caused the navbar to not render in the documentation. Although the source of this bug could not be made out, it seemed to have to do with how nuxt is resolving components. Adding an explicit import of KtNavbar in the file (and therefore not relying on the kotti-ui plugin for nuxt) fixes this. As the file change that triggered this is very unrelated and it would be impossible to see this very unrelated effect in code review, a test was added that should at least stop the very same event to occur Co-Authored-By: Florian Wendelborn <[email protected]>
- Loading branch information
1 parent
c4fa4a9
commit bec6660
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# What happened to make this test necessary? | ||
# | ||
# Beginning of June 2024 the documentation page had a peculiar bug: The main Navbar did not render. | ||
# | ||
# What was the cause of that bug? | ||
# | ||
# The bug was traced down to a change (that seemed entirely unrelated) in documentation/components/NavBar.vue | ||
# Closer investigation yielded that this change had an unintended effect on how nuxt is resolving imports | ||
# when it is rendering/hydrating components. | ||
# | ||
# How was this solved | ||
# | ||
# The fix was to make nuxt explictly resolve the component during SSR. This causes the following change to | ||
# index.html that is generated by `nuxt generate`: | ||
# | ||
# - <ktnavbar class="kt-navbar">...</ktnavbar> <!-- Will be hydrated client side --> | ||
# | ||
# + <nav class="kt-navbar">...</nav> <!-- pre-rendered server-side --> | ||
# | ||
# Why this test? | ||
# | ||
# Since this was impossible to foresee and would likely slip through a code review in a possible future scenario | ||
# this is a very basic sanity test to at least catch the very same scenario. | ||
|
||
if grep '</ktnavbar>' ./dist/index.html; | ||
then echo "The output of nuxt contains a 'ktnavbar' tag, this might be the result of a strange SSR bug" && false; | ||
else true; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters