/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { useObservableState } from 'observable-hooks';
import { useMemo } from 'react';
import { from, map } from 'rxjs';
export function useDataTable(id, workflow, existingTable) {
    const observable = useMemo(()=>workflow?.read$(id).pipe(map((t)=>t?.table)) ?? from([
            existingTable
        ]), [
        workflow,
        id,
        existingTable
    ]);
    return useObservableState(observable, ()=>existingTable);
}
