@mastra/react 0.2.34-alpha.0 → 0.2.34-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @mastra/react
2
2
 
3
+ ## 0.2.34-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed custom data stream parts so stable ids are preserved in React UI messages. ([#16067](https://github.com/mastra-ai/mastra/pull/16067))
8
+
9
+ - Updated dependencies [[`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d), [`8f6b651`](https://github.com/mastra-ai/mastra/commit/8f6b65181d0bbafb6f7cdbfc2d53e4d6587381c2)]:
10
+ - @mastra/core@1.32.0-alpha.1
11
+ - @mastra/client-js@1.17.0-alpha.1
12
+
3
13
  ## 0.2.34-alpha.0
4
14
 
5
15
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -228,30 +228,24 @@ var mapWorkflowStreamChunkToWatchResult = (prev, chunk) => {
228
228
  var toUIMessage = ({ chunk, conversation, metadata }) => {
229
229
  const result = [...conversation];
230
230
  if (chunk.type.startsWith("data-")) {
231
+ const dataPart = {
232
+ type: chunk.type,
233
+ data: "data" in chunk ? chunk.data : void 0,
234
+ ..."id" in chunk && typeof chunk.id === "string" ? { id: chunk.id } : {}
235
+ };
231
236
  const lastMessage = result[result.length - 1];
232
237
  if (!lastMessage || lastMessage.role !== "assistant") {
233
238
  const newMessage = {
234
239
  id: `data-${chunk.runId}-${Date.now()}`,
235
240
  role: "assistant",
236
- parts: [
237
- {
238
- type: chunk.type,
239
- data: "data" in chunk ? chunk.data : void 0
240
- }
241
- ],
241
+ parts: [dataPart],
242
242
  metadata
243
243
  };
244
244
  return [...result, newMessage];
245
245
  }
246
246
  const updatedMessage = {
247
247
  ...lastMessage,
248
- parts: [
249
- ...lastMessage.parts,
250
- {
251
- type: chunk.type,
252
- data: "data" in chunk ? chunk.data : void 0
253
- }
254
- ]
248
+ parts: [...lastMessage.parts, dataPart]
255
249
  };
256
250
  return [...result.slice(0, -1), updatedMessage];
257
251
  }