mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
Prevent Android chats from freezing or going blank (#1989)
* fix(app): stabilize streamed chat rendering Use deterministic Markdown AST keys and preserve unique row identities when an assistant message resumes after a tool. Keep native gesture and plan-card children correctly keyed to avoid unsupported Fabric reconciliation paths. * fix(app): stabilize retained native panels Keep retained workspace roots in a stable native order and make active panels present in the selection commit. Hidden panels now stop expensive subscriptions and animations without losing mounted state. * fix(app): harden retained panel activity
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
diff --git a/node_modules/react-native-markdown-display/src/lib/AstRenderer.js b/node_modules/react-native-markdown-display/src/lib/AstRenderer.js
|
||||
index 608e945..edafe12 100644
|
||||
--- a/node_modules/react-native-markdown-display/src/lib/AstRenderer.js
|
||||
+++ b/node_modules/react-native-markdown-display/src/lib/AstRenderer.js
|
||||
@@ -1,6 +1,5 @@
|
||||
import {StyleSheet} from 'react-native';
|
||||
|
||||
-import getUniqueID from './util/getUniqueID';
|
||||
import convertAdditionalStyles from './util/convertAdditionalStyles';
|
||||
|
||||
import textStyleProps from './data/textStyleProps';
|
||||
@@ -180,7 +179,7 @@ export default class AstRenderer {
|
||||
* @return {*}
|
||||
*/
|
||||
render = (nodes) => {
|
||||
- const root = {type: 'body', key: getUniqueID(), children: nodes};
|
||||
+ const root = {type: 'body', key: 'rnmr_root', children: nodes};
|
||||
return this.renderNode(root, [], true);
|
||||
};
|
||||
}
|
||||
diff --git a/node_modules/react-native-markdown-display/src/lib/util/tokensToAST.js b/node_modules/react-native-markdown-display/src/lib/util/tokensToAST.js
|
||||
index b0ed265..68e2150 100644
|
||||
--- a/node_modules/react-native-markdown-display/src/lib/util/tokensToAST.js
|
||||
+++ b/node_modules/react-native-markdown-display/src/lib/util/tokensToAST.js
|
||||
@@ -1,4 +1,3 @@
|
||||
-import getUniqueID from './getUniqueID';
|
||||
import getTokenTypeByToken from './getTokenTypeByToken';
|
||||
|
||||
/**
|
||||
@@ -7,9 +6,10 @@ import getTokenTypeByToken from './getTokenTypeByToken';
|
||||
* @param {number} tokenIndex
|
||||
* @return {{type: string, content, tokenIndex: *, index: number, attributes: {}, children: *}}
|
||||
*/
|
||||
-function createNode(token, tokenIndex) {
|
||||
+function createNode(token, tokenIndex, parentKey) {
|
||||
const type = getTokenTypeByToken(token);
|
||||
const content = token.content;
|
||||
+ const keyPath = parentKey ? `${parentKey}.${tokenIndex}` : `${tokenIndex}`;
|
||||
|
||||
let attributes = {};
|
||||
|
||||
@@ -27,12 +27,12 @@ function createNode(token, tokenIndex) {
|
||||
sourceMeta: token.meta,
|
||||
block: token.block,
|
||||
markup: token.markup,
|
||||
- key: getUniqueID() + '_' + type,
|
||||
+ key: `rnmr_${keyPath}_${type}`,
|
||||
content,
|
||||
tokenIndex,
|
||||
index: 0,
|
||||
attributes,
|
||||
- children: tokensToAST(token.children),
|
||||
+ children: tokensToAST(token.children, keyPath),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ function createNode(token, tokenIndex) {
|
||||
* @param {Array<{type: string, tag:string, content: string, children: *, attrs: Array}>}tokens
|
||||
* @return {Array}
|
||||
*/
|
||||
-export default function tokensToAST(tokens) {
|
||||
+export default function tokensToAST(tokens, parentKey = '') {
|
||||
let stack = [];
|
||||
let children = [];
|
||||
|
||||
@@ -51,7 +51,7 @@ export default function tokensToAST(tokens) {
|
||||
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const token = tokens[i];
|
||||
- const astNode = createNode(token, i);
|
||||
+ const astNode = createNode(token, i, parentKey);
|
||||
|
||||
if (
|
||||
!(
|
||||
Reference in New Issue
Block a user