cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.19k stars 1.68k forks source link

Web Proto: double loading #5832

Open BenjaminDeleze opened 1 year ago

BenjaminDeleze commented 1 year ago

Describe the Bug When loading a proto, the .proto file is loaded twice:

ad-daniel commented 1 year ago

I'm not sure to understand what you mean by loaded twice. prepareProtoDependencies goes through the PROTO tree and downloads all EXTERNPROTO references and it also takes care of generating the PROTO models from these files (the information is stored in cProtoModels). When the node building takes place, it's built from the model

BenjaminDeleze commented 1 year ago

I mean that the .proto is download twice. You can see that in the developper tools, in the network tab.

(on webots.cloud it is even more that twice as we load the proto to get the documentation but it's another problem)

ad-daniel commented 1 year ago

Note: to trigger the cascaded download of the PROTO dependencies prepareProtoDependencies is recursively used. It's fine for all sub-PROTO but this function is also used at the root level, for which the root file has been technically downloaded already (to trigger the recursion), so it should be possible to avoid downloading the root file twice