Skip to content

Add chat example and fix Solid generator bugs (F-1 through F-7)#99

Merged
nank1ro merged 9 commits into
mainfrom
t3code/2da165d9
May 26, 2026
Merged

Add chat example and fix Solid generator bugs (F-1 through F-7)#99
nank1ro merged 9 commits into
mainfrom
t3code/2da165d9

Conversation

@nank1ro
Copy link
Copy Markdown
Owner

@nank1ro nank1ro commented May 15, 2026

Summary

  • New chat example (examples/chat/) — a multi-channel real-time chat with pure in-process mock backend, exercising all major Solid primitives across @SolidState scalars/collections, @SolidQuery Streams, @SolidEffect, and @SolidEnvironment on both State<X> and plain classes
  • Generator bugs fixed:
    • F-1: Stream-form @SolidQuery with async* body now preserves the asterisk (annotation_reader._bodyKeyword joins body.star)
    • F-2: SignalBuilder wrapping now checks static type via resolved AST; non-Widget expressions are rejected, preventing invalid type assignments
    • F-3: stateless_rewriter._splitMembers now preserves non-build instance methods through the lift and runs value-rewriter over each
    • F-4: state_class_rewriter now runs value-rewriter over user methods (matching plain_class_rewriter behavior), fixing .value rewrites inside non-annotated methods
    • F-5: SPEC.md updated — removed stale restriction claiming plain classes with user-defined ctor + @SolidEffect are rejected (generator already supports this)
    • F-6: AGENTS.md now documents helper-method and dispose() behavior on lifted StatelessWidget
    • F-7: New golden query_with_cross_class_collection_dep locks in Stream query / cross-class collection semantics
  • Resolved-AST migrationbuilder.dart now calls buildStep.resolver.libraryFor + astNodeFor(..., resolve: true), populating Expression.staticType downstream; rewriters consult static type first, fall back to lexeme-based path on unresolved nodes
  • Aliased imports — annotation matching, superclass detection, widget-ness now work correctly with aliased imports (import '...' as fw; class X extends fw.StatelessWidget {})

Testing

  • examples/chat/: dart run build_runner build clean, dart format --set-exit-if-changed . passes, dart analyze --fatal-infos passes
  • dart analyze packages/solid_generator/test/golden/outputs/ passes
  • dart test packages/solid_generator/ — 252 tests pass
  • flutter test packages/integration_tests/ — 11 tests pass
  • New goldens: query_stream_async_star, stateless_lift_with_helpers, stateless_lift_with_user_init_state, state_class_user_method_same_class, state_class_user_method_cross_class, state_class_user_method_set_state_closure, query_with_cross_class_collection_dep
  • placement_visitor_test.dart covers non-Widget rejection path for SignalBuilder wrapping

nank1ro added 9 commits May 15, 2026 12:13
- Add examples/chat/: realistic multi-channel chat app demonstrating all Solid patterns
- Preserve non-build instance methods when lifting StatelessWidget (F-3)
- Fix async* Stream query code generation stripping asterisk (B-1)
- Fix SignalBuilder over-wrapping non-Widget expressions (B-2)
- Apply value-rewriting consistently to user methods on State<X> (F-4)
- Update SPEC.md to reflect current plain-class Effect behavior (F-5)
- Add AGENTS.md documentation for lifted widget helper methods (F-6)
- Reorder `.environment()` chains so Provider deps are above consumers
- Hoist signal reads out of deferred closures to build statement scope
- Generator synthesizes outer `SignalBuilder` when reads lack widget anchor
- Replace constructor-body signal writes with field initializers
- Add SPEC §7.1 documentation for unanchored-read case
- Extract typing indicator to separate component with dedicated lifecycle
- Sync typing state with incoming messages (~1.5s before arrival)
- Add auto-scroll to bottom with manual scroll detection and FAB
- Use broadcast stream controllers for per-channel typing state
- Properly dispose stream resources in backend.dispose()
- Added section explaining when dependencies appear first (.environment chains, bottom-up) vs last (MultiProvider, top-down)
- Includes worked examples for both forms
- Added troubleshooting entry for ProviderNotFoundException with reference to patterns section
- Collection seeding now uses constructor-body writes (re-entrance bug is fixed in 2.7.4)
- Remove obsolete SolidEnvironment workaround from troubleshooting docs
- Bump flutter_solidart across all examples and integration_tests
- Add troubleshooting entry explaining why reactive reads inside nested callbacks don't subscribe
- Improve code comments clarifying the hoisting pattern
- Remove verbose comment from chat_shell
- Add untracked<T>(callback) source stub to solid_annotations
- Detect verbatim untracked(...) calls and pass through to flutter_solidart
- Hide untracked from solid_annotations imports when both packages present
- Update spec with rationale: prevents cycles when writing collections in effects
- Use in chat example: wrap collection write to break keepChannelRead effect loop
@nank1ro nank1ro merged commit 4df8868 into main May 26, 2026
1 check passed
@nank1ro nank1ro deleted the t3code/2da165d9 branch May 26, 2026 13:49
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