@opengeni/react 2.5.0-canary.1 → 2.5.0-canary.2
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/dist/composer.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/react",
|
|
3
|
-
"version": "2.5.0-canary.
|
|
3
|
+
"version": "2.5.0-canary.2",
|
|
4
4
|
"description": "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views — token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@dnd-kit/utilities": "3.2.2",
|
|
117
117
|
"@fontsource-variable/noto-sans-arabic": "5.2.10",
|
|
118
118
|
"@fontsource-variable/noto-sans-jp": "5.2.10",
|
|
119
|
-
"@opengeni/sdk": "^2.5.0-canary.
|
|
119
|
+
"@opengeni/sdk": "^2.5.0-canary.2",
|
|
120
120
|
"clsx": "^2.1.1",
|
|
121
121
|
"lucide-react": "^1.8.0",
|
|
122
122
|
"motion": "^12.0.0",
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
useContext,
|
|
21
21
|
useEffect,
|
|
22
22
|
useId,
|
|
23
|
+
useLayoutEffect,
|
|
23
24
|
useMemo,
|
|
24
25
|
useRef,
|
|
25
26
|
useState,
|
|
@@ -369,18 +370,27 @@ export function useChatComposerController({
|
|
|
369
370
|
const mountedRef = useRef(true);
|
|
370
371
|
const deliveredValueRef = useRef(delivery.value);
|
|
371
372
|
const liveValueRef = useRef(delivery.value);
|
|
372
|
-
|
|
373
|
+
const [renderedValue, setRenderedValue] = useState(delivery.value);
|
|
374
|
+
const deliveryChanged = delivery.value !== deliveredValueRef.current;
|
|
375
|
+
if (deliveryChanged) {
|
|
373
376
|
deliveredValueRef.current = delivery.value;
|
|
374
377
|
liveValueRef.current = delivery.value;
|
|
375
378
|
}
|
|
376
379
|
const setComposerValue = useCallback(
|
|
377
380
|
(next: string) => {
|
|
378
381
|
liveValueRef.current = next;
|
|
382
|
+
setRenderedValue(next);
|
|
379
383
|
delivery.setValue(next);
|
|
380
384
|
},
|
|
381
385
|
[delivery.setValue],
|
|
382
386
|
);
|
|
383
|
-
const visibleValue =
|
|
387
|
+
const visibleValue = deliveryChanged ? delivery.value : renderedValue;
|
|
388
|
+
|
|
389
|
+
useLayoutEffect(() => {
|
|
390
|
+
if (renderedValue !== liveValueRef.current) {
|
|
391
|
+
setRenderedValue(liveValueRef.current);
|
|
392
|
+
}
|
|
393
|
+
}, [delivery.value, renderedValue]);
|
|
384
394
|
|
|
385
395
|
useEffect(() => {
|
|
386
396
|
mountedRef.current = true;
|