Skip to content

Troubleshooting ​

Look at the console and Network first. When something is refused it always leaves a message; nothing fails silently.

Console messages ​

The runtime's messages are in Chinese (they come from the PHP project). Match them by their beginning:

Message starts withMeaningFix
端點設定缺失 / 端點設定格式錯誤 (endpoint config missing / malformed)The page lacks the endpoint meta, or <html> has no data-cg-endpointsThe layout needs <html{{ cg_html_attrs() }}> and {{ cg_head() }}; the web middleware needs share_head
…被拒絕 —— 這個元素不在任何 data-render-blade-object 裡面 (refused, not inside any object)No object on the ancestor chainWrap it with runtime::render_object
…被拒絕 —— 物件 "X" 的 data-render-allow 只有 [...] (refused, object only allows …)The action isn't grantedDisplaying needs StateRead, writing StateWrite, rendering Render
data-render-blade-object 需要名稱 (needs a name)The value is an empty stringGive render_object a name
data-render-allow 有不認得的動作 X (unknown action)A typo in a hand-written attributeGenerate it with render_object, or write only render, state:read, state:write
data-state-class 需要 "key:class" 格式 (needs key:class)The colon is missingdata-state-class="advanced:is-open"
data-state-init:JSON 格式錯誤 (bad JSON)Starts with { but isn't valid JSONCheck the quotes, or use k=v; build values from Rust with serde_json
…無法序列化,略過 (can't serialize, skipped)The value contains a function, DOM node or circular referenceStore only JSON-serializable data
renderBladeAuto:容器需要 id (container needs an id)The render_auto container has no idAdd an id

Network status codes ​

POST /{prefix}/render returnsCauseFix
404Wrong prefix: the page and server have different APP_KEYs, or the page is oldReload; with several servers, check that APP_KEY matches
419The render token was already used or isn't in the sessionUsually an expired session or a blocked cookie; reload. When calling the endpoint yourself, switch to the key from each response
422 name: The selected name is invalid.The name isn't registeredCheck register() in src/cg/mod.rs for render::register(...), and data-render-name for typos
422 params.x …A param is too long or not a stringAt most 2048 characters per param
500The fragment function returned ErrCheck the server log

Clicking a button does nothing ​

  1. Is there a "被拒絕" (refused) in the console? → see the table above
  2. Is data-cg-event misspelled (renderBlade is case-sensitive)? Generating it with render_trigger avoids that
  3. Is resources/js/site.js loaded ({{ vite("resources/js/site.js") }} in the layout)?
  4. Was this HTML inserted with your own innerHTML? → without going through render fragments it isn't rebound
  5. Is Vite running / built?

The value was stored, but the page didn't change ​

  • You changed a copy you got back: s.get('o').x = 1 doesn't notify; use s.merge('o', { x: 1 }).
  • Arrays too: use s.update('list', (l = []) => l.concat(x)).
  • The display and the writer are in different namespaces. The same key under different objects is two different values.
  • Linker's data wasn't written: the nearest render object around the triggering element lacks StateWrite.

Text goes blank on load ​

data-state-text falls back to the text written in the template when the key has no value. If it really goes blank, usually:

  • The template had no initial value → use data-state-init="display=0"
  • Someone did set(key, ''), which really sets an empty string
  • Linker returned .data("x", None::<String>) → null

State disappeared after a re-render ​

  • Did you press F5? A reload always resets it; that's the spec.
  • Switched to another tab? Two tabs = two states.
  • A full-page navigation? pagehide clears it.
  • Page-mode navigation does not clear it; if it disappears in that case, something really is wrong.

A fragment is never unchanged ​

  • Does the fragment contain a Linker mount (linker::mount attributes)? It produces a new uuid every time. Move the mount point outside.
  • Does it contain a time, a random value, a CSRF token or anything else that differs every time?
  • Only Components mode has fingerprints.

Endpoints return 404 after an upgrade ​

Check the path in the Network panel. If it's still the old one, reload so the page and JS get the same endpoint configuration; on multi-node deployments, check that APP_KEY matches.

bash
laravel route:list

lists POST /{prefix}/render and the other routes. The real prefix is an HMAC of APP_KEY; in tests you can get it with cg_component::runtime::endpoints::prefix().