Problem when editing MPN in Library Editor

While updating manufacturer part numbers in my custom library, I noticed behavior that seems inconsistent and could possibly be a bug.

I often edit the MPN field in the Manufacturer Attributes section of a component. The workflow is very simple: I select a component, replace the existing MPN with a new one, and press Ctrl+S to save.

The save operation appears to complete successfully. I can see the green progress bar in the lower-right corner indicating that the library has been saved. However, when I navigate to another component and then return to the one I just edited, the old MPN is sometimes still present.

At first I thought the save operation had failed randomly, but after repeating the process many times I noticed a pattern. It seems that if I modify the MPN field and immediately press Ctrl+S, the new value is not always committed. On the other hand, if I first click on another field (for example the Manufacturer field) so that the MPN field loses focus, and only then save, the new MPN is stored correctly.

Has anyone else observed this behavior? Is it a known issue, or is there some expected workflow that requires leaving the field before saving?

After correcting all MPN values in my library, I tried to update the components already used in my existing projects.

I used:

Project → Project Library Manager → Update all elements

The update process completes without errors, but the new MPN values are still not visible in the existing project components.

System Information

LibrePCB Version: 2.1.1
Qt Version: 6.11.1 (built against 6.11.1)
Operating System: Linux Mint 22.3 (x86_64)
Runtime: AppImage

Gian Carlo

I didn’t check this specific case, but generally there are various fields in the UI which pass their value only to the backend when they loose focus (or maybe also by pressing the Return key). I wish we could fix that, but sometimes it is very difficult (almost impossible) to do it properly. So this is basically a known issue. I hope some day we find a way to improve that.

Regarding project library update: This operation intentionally does not update any MPNs in the project. MPNs of components in the project are independent of MPNs in the library. When you add/modify/remove MPNs in the library, LibrePCB cannot know how you want to change MPNs in the project (remove an already set MPN? add a new MPN without explicit user interaction? Replace an already set MPN by another? all dangerous operations IMHO).

This design decision also makes it possible to specify arbitrary MPNs in a project which don’t exist in the library - a huge time saver for a quick&dirty workflow.

However, after you modified MPNs in the library, the new MPNs should be visible in the “Add Component” dialog. So you can click the shopping cart in the component properties as described here where you should be able to choose one of the new MPNs. If this doesn’t work, it would be considered a bug.