Repository navigation
feat(platform/react): Base44ChatProvider, reading hooks and parts - #335
Open
amitbardos wants to merge 1 commit into
Open
amitbardos wants to merge 1 commit into
amitbardos wants to merge 1 commit into
Conversation
…t draw the chat <Base44ChatProvider> runs useBase44Chat once and shares it through context: useChatState() for items, status, connection and error, useChatActions() for send, create and clearError, stable across inline backend and onAppCreated. <Message> draws an item in a fixed order: text, then each step followed by its open question. A part for every question kind (Choice, Secrets, Approval) is required, so a new kind is a compile-time prompt on upgrade; the hook declines it until then. Text and Step fall back to plain HTML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.54-pr.335.2bd5f4fPrefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.54-pr.335.2bd5f4f"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.54-pr.335.2bd5f4f"
}
}
Preview published to npm registry — try new features instantly! |
Contributor
🚀 Package Preview Available! (
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The drawing layer above
useBase44Chat. It adds nothing below the hook's contract.<Base44ChatProvider>runs the hook once and shares it through context.useChatState()returnsitems,status,connectionanderror, and re-renders on every event.useChatActions()returnssend,createandclearError, and keeps its identity while the app stays the same, also with an inlinebackendoronAppCreated.components.questionwithoutChoice,SecretsandApproval. A release that adds a kind adds a part, so the upgrade names it; until then the hook declines the kind.TextandStepfall back to plain HTML with adata-base44attribute and no classes.<Message>draws the text, then each step followed by its open question. It adds no element of its own.<Question>draws a question anywhere below the provider.Message,Questionand the reading hooks throw a clear error outside a provider.Packaging
TSX support in
tsconfig, the type tests, vitest and eslint. Every new module starts with"use client", which the package test asserts.Tests
tests/unit/react/provider.test.tsx: draw order, each part answering its own tool call, replaced parts, pending prompts,<Question>elsewhere, errors outside a provider, re-render and identity stability with inline props.tests/types/react-provider.types.tsx: required question parts, noUnknown, bound actions per kind.tests/package.test.mjs: the new exports resolve from the tarball, and the declarations compile under NodeNext, Bundler and Node.npm test -w @base44/platformand lint pass locally.Not in this PR
The Tiny Sunny example (
examples/react-chat) from #314. It follows once the design doc settles whether to ship message primitives.🤖 Generated with Claude Code