Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to get project info after switching document #11

Open
radeeyate opened this issue Dec 18, 2024 · 9 comments
Open

Unable to get project info after switching document #11

radeeyate opened this issue Dec 18, 2024 · 9 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@radeeyate
Copy link

radeeyate commented Dec 18, 2024

When using this code below, you can run it a couple times before switching to a different document, trying it again, and observing it not function.

import * as extensionConfig from '../extension.json';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function activate(status?: 'onStartupFinished', arg?: string): void { }

export function about(): void {
  try {
    const boardInfo = eda.dmt_Project.getCurrentProjectInfo();
    Promise.resolve(boardInfo).then((info) => {
      if (info) {
        eda.sys_MessageBox.showInformationMessage(eda.sys_I18n.text(JSON.stringify(info)));
      } else {
        eda.sys_MessageBox.showInformationMessage("No board info available.");
      }
    });
  } catch (error) {
    eda.sys_MessageBox.showInformationMessage(String(error))
  }
}

The message box for errors is not even showing up, and instead I get the following errors in the console:

TypeError: Cannot read properties of undefined (reading 'attrsForSearch')
    at ui.js:2965:40305
    at dt (ui.js:1095:9647)
    at getCurrentProjectInfo (ui.js:2965:40232)
(anonymous) @ api.js:4
Promise.catch (async)
t @ api.js:4
execute @ api.js:4
push @ api.js:4
(anonymous) @ api.js:4
rpcCall @ api.js:4
getCurrentProjectInfo @ api.js:4
eval @ VM334:4
(anonymous) @ api.js:7
fr @ api.js:7
(anonymous) @ api.js:30
execute @ api.js:4
publish @ api.js:4
y @ ui.js:2172
onClick @ ui.js:2172
onClick @ ui.js:1101
vYi @ ui.js:1032
EYi @ ui.js:1032
jYi @ ui.js:1032
Gpt @ ui.js:1032
Wpt @ ui.js:1032
(anonymous) @ ui.js:1032
xje @ ui.js:1035
K1t @ ui.js:1032
xEe @ ui.js:1032
cEe @ ui.js:1032
ZYi @ ui.js:1032
preload.js:17 Uncaught Error: TypeError: Cannot read properties of undefined (reading 'attrsForSearch') https://modules.lceda.cn/pro-api/0.1.79.941a04f4/api.js 4 7059 Error: TypeError: Cannot read properties of undefined (reading 'attrsForSearch')
    at api.js:4:7059
    at rr.callback (api.js:4:6500)
    at rr.execute (api.js:4:6078)
    at zo.publish (api.js:4:7378)
    at api.js:4:6744
ir @ preload.js:17
api.js:4 Uncaught Error: TypeError: Cannot read properties of undefined (reading 'attrsForSearch')
    at api.js:4:7059
    at rr.callback (api.js:4:6500)
    at rr.execute (api.js:4:6078)
    at zo.publish (api.js:4:7378)
    at api.js:4:6744
(anonymous) @ api.js:4
(anonymous) @ api.js:4
execute @ api.js:4
publish @ api.js:4
(anonymous) @ api.js:4
PromiseRejectionEvent {isTrusted: true, reason: Error: TypeError: Cannot read properties of undefined (reading 'attrsForSearch')
    at https://mod…, type: 'unhandledrejection', target: Window, currentTarget: Window, …}
api.js:4 Uncaught (in promise) Error: TypeError: Cannot read properties of undefined (reading 'attrsForSearch')
    at api.js:4:7059
    at rr.callback (api.js:4:6500)
    at rr.execute (api.js:4:6078)
    at zo.publish (api.js:4:7378)
    at api.js:4:6744

Edit: after digging a bit more, it seems to be a problem with the promise.

@yanranxiaoxi
Copy link
Member

Thanks for the feedback.

After internal testing, it should be an interface parsing error due to data format modification. A bug ticket has been raised to fix it.

@yanranxiaoxi
Copy link
Member

It has been fixed within us. The fix will be released in the next beta version (2.2.34.6).

@yanranxiaoxi yanranxiaoxi self-assigned this Dec 20, 2024
@yanranxiaoxi yanranxiaoxi added bug Something isn't working good first issue Good for newcomers labels Dec 20, 2024
@radeeyate
Copy link
Author

Thanks for the quick response! Do you have any idea on when that might be released? And also - how might I be able to switch to the beta version?

@yanranxiaoxi
Copy link
Member

I'll let you know here when the version is available.

@yanranxiaoxi
Copy link
Member

yanranxiaoxi commented Dec 23, 2024

@radeeyate Hi~

The current latest version will not be available in open beta. But you can already access it from that address:
https://pro.easyeda.com/editor

@radeeyate
Copy link
Author

Great, thank you! My extension is now reporting the expected behavior.

@radeeyate
Copy link
Author

Hi @yanranxiaoxi,

Shortly after this banner was added this morning, the exact same error seems to be occuring even when on the new editor link.
image
image

@easyeda2021
Copy link
Collaborator

you can download the 2.2.34.8 at https://easyeda.com/page/download

@radeeyate
Copy link
Author

The error is still occurring on 2.2.34.8. Is the extension API not up to date for that version?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants