cart – Magento 2 Quote Refresh Api

HI I am developing an API where I faced a challenge in my cart listing api, I need to apply cart rule and add it in quote and need to update quote accordingly.

The Problem here is my quote do get updated but on 2nd refresh. I mean when I try to hit the Api first time the rule doesnt get applies but after second time I refresh the Api, the quote gets updated and refreshes it.

I am not sure whether my cart rule was not being applied or not but I tried and debugged the code and found out rule was being applied but I think quote is not being updated.

Any reason why this happens.
Below is my code snippet which I tried but couldnt achieve the desired result.

if($firstOrder == 1)
            $cartResult1 = $this->quoteRepository->getActiveForCustomer($customerId);
            $quote = $this->quoteRepository->get($cartResult1('quote')('id'));
            $this->customerCondition->setData('customer_first_order', $firstOrder);
            //echo json_encode($quote->getData()); die;
            $cartResult = $this->quoteRepository->getActiveForCustomer($customerId);
            //print_r(json_encode($cartResult('quote'))); die;