FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(content): call composables in setup, not inside computed getters by TheMeinerLP · Pull Request #261 · OneLiteFeatherNET/launchpad · GitHub

fix(content): call composables in setup, not inside computed getters - #261

Merged
TheMeinerLP merged 2 commits into
mainfrom
fix/prosepre-usei18n
Aug 4, 2026
Merged

TheMeinerLP merged 2 commits into
mainfrom
fix/prosepre-usei18n

Conversation

TheMeinerLP commented Aug 3, 2026 •
edited
Loading

Copy link
Copy Markdown
Collaborator

Implements CNT-06, test-first. The finding names one file; there are two.

Why it works, and why that is the problem

A composable resolves its component through getCurrentInstance(), which is only set during setup. Called from inside a computed getter it works by accident: Vue's implementation is currentInstance || currentRenderingInstance, so while the getter runs as part of a render the rendering instance stands in.

That holds exactly as long as nothing evaluates the computed outside a render — a watcher, a pre-flush job, a unit test reading .value. vue-i18n throws MUST_BE_CALL_SETUP_TOP the moment it does.

file call
ProsePre.vue useI18n() — the one the finding names
ProseImg.vue useRuntimeConfig() — same shape, not mentioned

ProseHeading.vue already has the right shape, with const { t, te } = useI18n() beside defineProps and the computed closing over it. Hoisting also stops the lookup repeating on every re-evaluation.

Verified on the page that renders them

Both components are blog-article prose, so I rendered an article with seven code blocks and an image:

7 × <pre … aria-label="Code in yaml">
<img … src="/images/blog/cluster-topology-social.png">

The interpolated "Code in yaml" is the proof that matters — it is the hoisted t producing a translated, parameterised string, not a fallback.

Then the whole article, before and after, ignoring <script> blocks: byte-identical, 99 961 both ways.

The guard

Flags any useX() call inside a computed(() => { … }) body across components, pages, layouts and composables. The self-test pins both directions — a call inside the getter is caught, the same call hoisted above it is not — so it cannot decay into matching everything or nothing.

Gates

Suite: 121 tests, 41 files. Build green. Ratchet unchanged at 334 / 39 / 21 (this branch is cut from d63bc02; #260 lowers the error count to 320 by a different route).

Refs: CNT-06

🤖 Generated with Claude Code

https://claude.ai/code/session_017uWFJwn6dswmNtR8kKB86s

cloudflare-workers-and-pages Bot commented Aug 3, 2026 •
edited
Loading

Copy link
Copy Markdown

Deploying with    Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
launchpad 649bc21 Commit Preview URL

Branch Preview URL
Aug 03 2026, 09:05 PM

TheMeinerLP merged commit 751daa2 into main Aug 4, 2026
7 checks passed
TheMeinerLP deleted the fix/prosepre-usei18n branch August 8, 2026 09:28
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL