perf: trim session IPC hot paths and fix clear-effects idle render
Skip full project broadcast on graph/NPC position commits, send session.stateChanged only to consumer windows, and force one Pixi render before stopping the idle ticker so Clear effects actually clears the canvas. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -685,7 +685,31 @@ export function NpcsEditorApp() {
|
||||
setRelationModal({ mode: 'create', sourceNpcId, targetNpcId });
|
||||
}}
|
||||
onNodePositionCommit={(npcId, x, y) => {
|
||||
void api.invoke(ipcChannels.project.updateNpcPosition, { npcId, x, y });
|
||||
void (async () => {
|
||||
setSession((prev) => {
|
||||
if (!prev?.project) return prev;
|
||||
return {
|
||||
...prev,
|
||||
project: {
|
||||
...prev.project,
|
||||
npcs: prev.project.npcs.map((n) => (n.id === npcId ? { ...n, x, y } : n)),
|
||||
},
|
||||
};
|
||||
});
|
||||
try {
|
||||
const res = await api.invoke(ipcChannels.project.updateNpcPosition, {
|
||||
npcId,
|
||||
x,
|
||||
y,
|
||||
});
|
||||
setSession({
|
||||
project: res.project,
|
||||
currentSceneId: res.project?.currentSceneId ?? null,
|
||||
});
|
||||
} catch {
|
||||
/* позиция уже оптимистично в UI; следующий session sync поправит при CRUD */
|
||||
}
|
||||
})();
|
||||
}}
|
||||
onEditRelation={(relationId) => {
|
||||
const rel = relations.find((r) => r.id === relationId);
|
||||
|
||||
Reference in New Issue
Block a user