fix: add Kubernetes port forward IPCs and events by jeffmaury · Pull Request #9505 · podman-desktop/podman-desktop (original) (raw)

So sorry, but after testing it, I provided the wrong solution:

I recommended to add the objects when sending the events as followed

this.apiSender.send('kubernetes-port-forwards-update', this.listForwards());

This is a problem because listForwards is async! (why?)

IMO it should clearly not be async... but this is because the interface ForwardConfigStorage declare it async

https://github.com/containers/podman-desktop/blob/234674a252f1fef3051e72c6fc61f7cb24ff4e66/packages/main/src/plugin/kubernetes/kubernetes-port-forward-storage.ts#L58

We cannot just remove the promise, because we have an implementation using the async (FileBasedConfigStorage),

Therefore we need to do the following