Currently this API endpoint loops through predecessorid till it reaches null to find base component for a given component id.
And it takes somewhere between 10-40 seconds to get a the basecomponent id for a component which has many versions.
Why not return the component with id=parentid which is the id of the basecomponent and if it's null then just return the component itself?
This will make this API endpoint a lot faster.