Build a 'My Orders' page showing past orders with infinite scrolling that fetches older orders
Asked in the tech 1 stage. Reported follow-ups included caching scroll position and pagination.
Implement merge_order_pages(pages). pages is a list of fetched pages in newest-to-oldest order. Each page contains order dictionaries with an id and integer created_at timestamp, and may overlap the previous page. Return one list containing each order ID once, sorted from newest to oldest. If the same ID appears more than once, keep its first occurrence.
def merge_order_pages(pages):