Repository navigation
Conversation
VirtualListItemTemplate returned any. Every slot renders
{itemTemplate(...)}, and an any result lowers to gea::Value, which
gea::jsx::child has no rule for, so an app that used the component
stopped at a static_assert in the C++ build. No app or test imported the
component, so nothing caught it (geastack#70).
The template's result is now GeaJsxElement, the type core uses for a
component's returned element. It lowers to an element handle that
gea::jsx::child appends. The .d.ts says to wrap plain text in an element:
TypeScript still accepts a string because GeaJsxElement is an empty
interface, but geatsc then refuses it at compile time with a named
conversion error.
Tests: added run-gea-elements-virtual-list-pipeline.sh, which builds the
fixture packages/core/test/fixtures/gea-elements-virtual-list (the
component used the way the README shows) and checks that the list takes
its height from its class and that its 16 slots show rows 0..15 once
each. It passes. With the template typed any again the C++ build fails
with the static_assert, and with vlIndexForSlot shifted by one the row
check fails. The fixture type-checks with tsc 5.9.3 (strict). Scrolling
is not tested: onScroll waits on geastack/compiler#4, and a scrollTop
change replaces the <virtual-list> node (geastack#70).
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A native build resolves value imports of @geastack/elements to
components/index.ts, not index.d.ts. index.ts exported VirtualList but
not VirtualListProps or VirtualListItemTemplate, so an app that wrote
`import { VirtualList, type VirtualListItemTemplate } from
'@geastack/elements'` type-checked but failed to compile natively with
"has no exported member 'VirtualListItemTemplate'". index.ts now
re-exports both types as index.d.ts does. CameraViewProps has the same
gap and is left for a separate change.
Tests: a scratch app importing VirtualList, VirtualListProps and
VirtualListItemTemplate this way, built with
run-gea-native-app-pipeline.sh: fails with that error before the
change, builds and renders its rows after it.
run-gea-elements-virtual-list-pipeline.sh still passes.
|
Pushed a6771b7: |
Part of #70 (item 1).
Problem
@geastack/elementsVirtualListdoes not compile to C++.VirtualListItemTemplatereturnsany, and each slot renders{itemTemplate(...)}(VirtualList.tsx:79-82). Ananyresult lowers togea::Value, whichgea::jsx::childhas no rule for, so the C++ build stops:No app or test imports the component, so nothing caught it.
Fix
Type the template's result as
GeaJsxElement, the type core uses for a component's returned element, inVirtualList.tsxandVirtualList.d.ts. The result now lowers to an element handle, whichgea::jsx::childappends. The.d.tssays to wrap plain text in an element.GeaJsxElementis an empty interface, so TypeScript still accepts a template that returns a string. geatsc then refuses it at compile time with "no runtime conversion is installed from string to native-handle(jsx-element)", instead of the C++ static_assert. Underany, no template compiled at all.Tests
run-gea-elements-virtual-list-pipeline.shwith the fixturepackages/core/test/fixtures/gea-elements-virtual-list, so the test does not depend on geastack/examples. The fixture uses the component the way the README shows.test_gea_elements_virtual_list_main.cppchecks:anyagain, the C++ build fails with the static_assert above.vlIndexForSlotshifted by one, the test fails with "expected rows 0..15 once each, got 16 labels: 1 2 ... 16".mainapart from the new test. The two failures fail onmaintoo:run-ui-memory-census.shneeds a reference engine, andtest_gea_vite_module_graph_assets.mjsis fixed by Point the module-graph asset test's compiler at this checkout's Core #66.run-gea-virtual-list-pipeline.sh(the raw tag) still passes.Not covered
Scrolling is not tested.
onScrolldoes not fire until geastack/compiler#4 lands, and even then ascrollTopchange re-rendersVirtualListand replaces its<virtual-list>node, which resets the scroll offset. Both are described in #70. Target scope: native harness tested; other targets source-only.