File tree Expand file tree Collapse file tree
apps/sim/app/workspace/[workspaceId]/home/components/user-input Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,26 @@ export function UserInput({
179179 useEffect ( ( ) => {
180180 const prev = prevSelectedContextsRef . current
181181 const curr = contextManagement . selectedContexts
182- const removed = prev . filter ( ( p ) => ! curr . some ( ( c ) => c . kind === p . kind && c . label === p . label ) )
182+ const contextId = ( ctx : ChatContext ) : string => {
183+ switch ( ctx . kind ) {
184+ case 'workflow' :
185+ case 'current_workflow' :
186+ return `${ ctx . kind } :${ ctx . workflowId } `
187+ case 'knowledge' :
188+ return `knowledge:${ ctx . knowledgeId ?? '' } `
189+ case 'table' :
190+ return `table:${ ctx . tableId } `
191+ case 'file' :
192+ return `file:${ ctx . fileId } `
193+ case 'folder' :
194+ return `folder:${ ctx . folderId } `
195+ case 'past_chat' :
196+ return `past_chat:${ ctx . chatId } `
197+ default :
198+ return `${ ctx . kind } :${ ctx . label } `
199+ }
200+ }
201+ const removed = prev . filter ( ( p ) => ! curr . some ( ( c ) => contextId ( c ) === contextId ( p ) ) )
183202 if ( removed . length > 0 ) removed . forEach ( ( ctx ) => onContextRemoveRef . current ?.( ctx ) )
184203 prevSelectedContextsRef . current = curr
185204 } , [ contextManagement . selectedContexts ] )
You can’t perform that action at this time.
0 commit comments