specific-silverS
Refine3y ago
14 replies
specific-silver

tableProps Dependent on useShow() Attribute Causing Error

Hello,

I have a 'show' page for a store that queries for its products by using a permanent on the products --

    const { queryResult } = useShow()
    const { data } = queryResult

    const record = data?.data

    const { tableProps} = useTable({
        resource: "products",
        filters: {
            permanent:
                [{
                    field: "storeID",
                    operator: "eq",
                    value: record?.id,
                },
                ]
        },
    })


However, because 'record' doesn't exist for a split second before useTable is called, I'm getting the error Error: The provided href (/stores/show/[id]?pageSize=10&current=1) value is missing query values (id) to be interpolated properly.

Is there any way I can make useTable 'wait' for the record?.id?
Was this page helpful?