docs
docs copied to clipboard
Fix greeting banner code snippet in blog tutorial [i18nIgnore]
Description (required)
The text at the end of step 3 says to expect a 'random' greeting (I've checked this is the case in en and fr translations), but this won't happen on page load unless randomMessage is used instead of messages[0]. It appears this was already fixed in 'es' translation as a part of c81a980b6a, where the snippet in es already refers to randomMessage().
I'm not sure if patching this all in one PR is acceptable now that I've just seen the "PRs only in one language please" note, but this seems like the obvious fix to me. Let me know if I need to change it.
Related issues & labels (optional)
- Suggested label:
code snippet update
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
docs | ✅ Ready (Inspect) | Visit Preview | Jun 3, 2024 4:50pm |
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉
Here’s what will happen next:
-
Our GitHub bots will run to check your changes. If they spot any broken links you will see some error messages on this PR. Don’t hesitate to ask any questions if you’re not sure what these mean!
-
In a few minutes, you’ll be able to see a preview of your changes on Vercel 🥳
-
One or more of our maintainers will take a look and may ask you to make changes. We try to be responsive, but don’t worry if this takes a few days.
Lunaria Status Overview
🌑 This pull request will not trigger status changes.
Learn more
Lunaria automatically ignores changes on specific PRs by adding a ignored keyword in its title. Found: i18nIgnore
.
You can change this by either removing the keyword above from the PR's title, or modifying the ignoreKeywords
property in your Lunaria configuration file.
Tracked Files
[!NOTE]
The notes below indicate what would happen if the pull request is merged when triggering status changes. Since a ignored keyword was found in the PR's title, the status changes indicated below won't be applied.
Locale | File | Note |
---|---|---|
es | tutorial/6-islands/1.mdx | Localization changed, will be marked as complete. |
Warnings reference
Icon | Description |
---|---|
🔄️ | The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied. |
I've just realised that this change probably also means the sample code in https://github.com/withastro/blog-tutorial-demo/blob/complete/src/components/Greeting.tsx would need an update too.
As an aside, using randomMessage() instead of messages[0] also serves to highlight a potentially important learning goal which is hinted at in step 5: the fact that when using client:load directive the js there is run twice. Once when building the initial HTML, and again when the js is passed to the client (evident on page load, as you can sometimes see the message briefly load and then change as the front end code is run, getting back a different value from the random call).
Saw the comment about updating https://github.com/withastro/blog-tutorial-demo/blob/complete/src/components/Greeting.tsx, definitely a 👍 from my end
Hi @snake ! This code is in fact intentional, from #2908.
You're right that the Spanish translation is currently incorrect showing the old version. An update to that language file to match the English would be a helpful contribution!
I'll let you decide whether to update this PR or close this and make a new one with just the update to the es
file. If you do make a new PR, mentioning this PR #7932, and/or #2908 in that PR description would be great and would help the maintainers know what's going on! :raised_hands:
(Also, in future, please do follow the request to only PR one language. The reason is not related to the size/nature of the fix, but how our translation tracking works and how our GitHub labeling works. In fact, the reason this PR was not noticed sooner was because it was mislabeled! :sweat_smile: )
Thanks, @sarah11918. Interesting. So the situation I explained above IS the hydration mismatch in action (the message flicker), and that's been fixed by hardcoding (well, popping the first item) in #2908. Got it. (I guess shame on me for not checking the change history there, ooops!).
I think there's perhaps merit in making this clear in the tutorial docs then (which currently mention 'random message' in a number of places last I checked) - which I guess is a job for a separate PR.
I'll try to update this PR to fix the 'es' lang pack instead.
Thanks!