4D in BWEB
This page gathers the traps specific to page rendering and to component code. Traps in the language itself are on The 4D language.
Inside 4D tags
You cannot call a method from #4DIF or #4DEVAL. The tag is echoed as plain text instead of being evaluated. Compute the value in a #4DCODE block first, then test the variable. The || short-circuit often hides the defect on the public site, so it only shows up on /bweb/* screens.
An error inside #4DCODE renders the block completely empty, with no message anywhere. When a block disappears without explanation, put a trace at the top of the code and narrow down: the failure is inside, not in the block's configuration.
cs does not exist inside PROCESS 4D TAGS. Go through ds.MyDataClass.render() or another dataclass entry point.
There is a limit on PROCESS 4D TAGS per block. A very large block silently stops processing tags partway.
Component versus host
From the component, address host tables as ds["TABLE"], never ds.TABLE. Host tables do not exist when the component is compiled, so the dot form fails at compile time — and a Try does not protect against a compilation error. Use an untyped reference.
Process variables are not shared between host and component. Setting one on the component side is invisible from the host; that is what BSPH_SET_PROCESS_VAR is for.
For host tables, the active entity class is the host's (Project/Sources/Classes). The copies under the component's Resources/Misc/DataClasses are installation templates, not running code — editing them changes nothing until an install replays them.
Custom code goes outside the START BSPK / END BSPK tags. Anything inside is regenerated. Never edit the BSPK_* classes themselves.
The dev panel runs in a Shadow DOM
Since the panel was moved into a shadow root, three habits stop working:
- implicit globals are dead — a function declared in one panel script is not visible from another; export it explicitly;
event-onClickattributes in markup do not fire — listeners must be attached inside the shadow root;document.querySelectordoes not reach panel nodes, and conversely the panel carriesdata-uuidattributes of its own. A selector meant for page blocks that is not scoped will match panel nodes too — which has already deleted the wrong element.
Quote and escape data-uuid selectors, and always scope them. The details are on The dev panel.
Diagnosing a whole page that dies
A page that renders as the "Wakanda" 404 on every URL, including /_claude/ping, is not a routing problem: it means BSPK_WEB_ON_CONNECTION does not compile. bspk.log stays empty. Compare the If / End if balance against git HEAD.
A single block that kills the render names itself: the dev toast reports the block, its uuid and the error.
Templates and caches
A .html under Resources/bweb/bspk/ stays inert until BSPK_REFRESH_STORAGE — templates are cached in Storage. JavaScript, by contrast, is served straight from disk.
A rendered result can be cached in the session. A changed column formula or conditional display can keep showing the old result: F5 and a reload are not enough, you have to log out and back in.
Trap: this session cache makes correct code look broken.
See also
- The 4D language — the language-level traps
- Reload or restart — what actually reloads what

