diff --git a/.changeset/five-jokes-teach.md b/.changeset/five-jokes-teach.md new file mode 100644 index 000000000..29c4e6bad --- /dev/null +++ b/.changeset/five-jokes-teach.md @@ -0,0 +1,5 @@ +--- +"@assistant-ui/react": patch +--- + +fix(external-store): add initial messages to message repository diff --git a/packages/react/src/runtimes/external-store/ExternalStoreThreadRuntime.tsx b/packages/react/src/runtimes/external-store/ExternalStoreThreadRuntime.tsx index a9b3811f3..962490fa5 100644 --- a/packages/react/src/runtimes/external-store/ExternalStoreThreadRuntime.tsx +++ b/packages/react/src/runtimes/external-store/ExternalStoreThreadRuntime.tsx @@ -31,14 +31,16 @@ export class ExternalStoreThreadRuntime implements ReactThreadRuntime { }; } - public messages; - public isDisabled; - public isRunning; + public messages: ThreadMessage[] = []; + public isDisabled = false; + public isRunning = false; constructor(public store: ExternalStoreAdapter) { - this.isDisabled = store.isDisabled ?? false; - this.isRunning = store.isRunning ?? false; - this.messages = store.messages; + this.updateData( + store.isDisabled ?? false, + store.isRunning ?? false, + store.messages, + ); this.useStore = create(() => ({ store,