open-olive / loop-development-kit

The JavaScript/TypeScript Loop Development Kit for Olive Helps.
MIT License
20 stars 18 forks source link

Callback not found. [BUG]: #606

Open rinwa opened 2 years ago

rinwa commented 2 years ago

Describe the bug

Callback not found. I am getting this error.

Steps to Reproduce

I provided the code to reproduce it. When you click on the link. You will get this error in the log file. After that links are not working.

{ message: "Error invoking remote method 'message-whisperInteraction': callback not found", stack: "Error: Error invoking remote method 'message-whisperInteraction': callback not found\n" + ' at Function. (file:///C:/Users/Sumit.Rinwa/AppData/Local/olive-helps/app-0.47.4/resources/app/.webpack/renderer/sidebar/index.js:2:1256710)' }

Olive Helps Version

0.47.4

LDK Version

"@oliveai/ldk": "*"

Operating System

Window

Code Sample

import { whisper } from '@oliveai/ldk'; import { WhisperComponentType } from '@oliveai/ldk/dist/whisper/types'; import { stripIndent } from 'common-tags';

export default class CopyData { constructor() { this.whisper = undefined; this.label = 'Link Info'; }

show() { whisper .create({ components: [ { body: 'All Link here', type: WhisperComponentType.Markdown, }, ], label: 'Links Info', onClose: () => { console.log('closed change info whisper'); }, }) .then((newWhisper) => { this.whisper = newWhisper; }); }

update(comp) { this.whisper.update({ label: this.label, components: [...comp], onClose: () => {}, }); }

creatingLink(allData) { let markdownLink = | Link: |\n| :----------|\n; allData.forEach((element, j) => { markdownLink += |●  [${element.name}](#${j + 1})| \n; });

let markdownAll = stripIndent` ${markdownLink}`;
let markdown1 = {
  body: markdownAll,
  type: WhisperComponentType.Markdown,
  onLinkClick: (error, linkName) => {
    console.info(`Received click on the link: ${JSON.stringify(linkName)}`);
    console.info('error=============', JSON.stringify(error));
  },
};
this.update([markdown1]);

} } //class end here let arr1 = [{ name: 'link1' }, { name: 'link1' }]; let arr2 = [{ name: 'link3' }, { name: 'link4' }]; let cp = new CopyData(); cp.show();

setTimeout(() => { cp.creatingLink(arr1); }, 700);

setTimeout(() => { cp.creatingLink(arr2); }, 1500);

Additional Context

No response

Code of Conduct

racary-olive commented 2 years ago

@rinwa it looks like the component loses the onLinkClick property during the update of the whisper. We'll work on getting a bug card opened to track a fix for this