Any way to redo this logic without an infinite loop? - SolidJS