POS UI Extensions: addLineItem very slow on initial use

Hi all,

We’re using the addLineItem function from the Cart API to add items to cart in our POS UI Extension. We’ve noticed that when adding the first item to cart it’s very slow (up to 3 - 5 seconds), but then when adding additional items to cart within the same cart session, it’s much faster (1 - 2 seconds).

Are there any options available to speed this up? We’ve tested this by generating a brand new extension and using this approach:

const handleAddToCart = useCallback(
    async (productId: string, quantity: number) => {
      try {
        setIsLoading(true);
        // Add new line item
        const lineItemUuid = await addLineItem(
          Number(productId),
          Number(quantity)
        );

        setIsLoading(false);
        toast.show("Added to Cart Successfully " + lineItemUuid);
        navigation.dismiss();
      } catch (error) {
        console.error("Error adding to cart:", error);
        toast.show("Unable to add item to cart.");
      }
    },
    []
  );

Please see the following recording we made showing the issue:

Any advice would be very much appreciated :folded_hands:t5: