easyeda / easyeda/easyeda-api-skill
Bug: setState_Net().done() on existing schematic netport clears net instead of updating it
- Dominant language
- JavaScript
- Stars
- 699
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
When using the EasyEDA bridge to update an existing schematic `netport` component, calling `toAsync().setState_Net(newNet).done()` did not update the net name to `newNet`. Instead, the net became an empty string (`""`) when read back with `getState_Net()`.
Creating a new net port with `sch_PrimitiveComponent.createNetPort('BI', newNet, x, y, rotation, mirror)` works correctly and immediately returns the expected net name.
## Environment
- Skill repository/version: `easyeda-api-skill` v1.1.3
- Bridge: `scripts/bridge-server.mjs`
- EasyEDA context: schematic page, existing `netport` primitives
- Host OS: Windows
- Node.js: v24.14.1
## Reproduction
1. Open a schematic page containing an existing net port, for example one with net `RGB_DB2`.
2. Fetch that existing net port with `sch_PrimitiveComponent.get(id)` or from `sch_PrimitiveComponent.getAll()`.
3. Try to update its net:
```js
const port = await eda.sch_PrimitiveComponent.get('existing-netport-id');
const asyncPort = port.toAsync();
asyncPort.setState_Net('GPIO1_C5_d');
await asyncPort.done();
const check = await eda.sch_PrimitiveComponent.get('existing-netport-id');
return check.getState_Net();
```
## Expected behavior
`check.getState_Net()` should return:
```text
GPIO1_C5_d
```
## Actual behavior
`check.getState_Net()` returned an empty string:
```text
```
In my test, multiple existing `netport` primitives with original net names such as `RGB_DB2`, `RGB_DB3`, etc. were changed to blank nets after attempting `setState_Net(...).done()`.
## Workaround
Deleting the original net port and recreating it at the same coordinates works:
```js
await eda.sch_PrimitiveComponent.delete('existing-netport-id');
const created = await eda.sch_PrimitiveComponent.createNetPort(
'BI',
'GPIO1_C5_d',
x,
y,
rotation,
mirror
);
return created.getState_Net();
```
This returns the expected new net name.
## Notes
The issue was observed while replacing `RGB_*` net labels with the corresponding `GPIO*` names from U1 pin descriptions. The replacement only became reliable after deleting and recreating the net ports.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.