How to accurately determine what variant is displayed by default without Liquid Part 2

This is a follow-up to How to accurately determine what variant is displayed by default without Liquid

The recommended solution there was to use webhooks + server-side Storefront API calls to grab Product.selectedOrFirstAvailableVariant but we are re-evaluating this do to the needless amount of processing required for a feature that many shops do not use.

Our thoughts were instead of doing this server-side we can use the AJAX API then do:

variants.find((variant) => variant.available)

It sounds like this is a reliable way to replicate this but not 100% sure.

Of course if that doesn’t work calling Storefront API directly client-side using the @inContent directive and grab Product.selectedOrFirstAvailableVariant there but this is slightly more bloated.

Thoughts?