[BUG] refreshButton is asking for default dataProvider
See original GitHub issueDescribe the bug
On a show
view page, we are using show with custom dataProviderName
as below:
const { queryResult } = useShow({ dataProviderName: "xyz" });
return <Show isLoading={isLoading} > some content </show>
This is resulting in below error from RefreshButton
. The RefreshButton
is not considering the useShow
’s dataProviderName, instead looking for default
data provider.
Providing the RefreshButton
manually as below avoids the errors, but it does not take advantage of in-built buttons of the show
component. I have to write all those buttons code again explicitly.
<Show isLoading={isLoading}
pageHeaderProps={{
extra: <RefreshButton dataProviderName="xyz" onClick={() => queryResult.refetch()} /> }}>
All of this code duplication just to provide custom dataProviderName for the RefreshButton.
Q: can RefreshButton take useShow
’s dataProviderName by default?
To Reproduce Use Refine with custom data provider as below:
<Refine
dataProvider={{
xyz: dataProvider("https://api.fake-rest.refine.dev"),
}}
and on your show view, use code as below:
const { queryResult } = useShow({ dataProviderName: "xyz" });
return <Show isLoading={isLoading} > some content </show>
You will start to see the errors
Issue Analytics
- State:
- Created a year ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
In Flex how to refresh dataprovider on datagrid - Stack Overflow
I created Event by click_button that insert data and get data into Datagrid.... The problem is the datagrid. It refresh data only when...
Read more >Get help with linked data type refresh errors - Microsoft Support
You may encounter refresh errors when you are working in a workbook with data types, either by manually refreshing or if Automatic Refresh...
Read more >Single Data Provider Refresh - Wiki - SAP
Refreshes all Data Providers contained in the workbook. This option is only available if there exists at least one Data Provider which was...
Read more >ListDataProvider refreshAll() does not update the grid - Vaadin
I could not figure out how to refresh the ListDataProvider from the backend when the underlying data in the database is changed (i.e.....
Read more >Reload layer attribute table after editing the dataProvider
Despite this, an attribute table opened via right-clicking the layer name still only shows 2 fields until it is reloaded using the button....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @omeraplak I have tested the “@pankod/refine-antd”: “^3.27.2” and the
show
component now seems nicely working with custom data providers. TheRefreshButton
is also picking up the correct data provider etc.Looks like the
dataProviderName
is missing in theuseImport
of the core module: https://github.com/pankod/refine/blob/c1908141d25e38bbd67aa3e9eb755bf538369aba/packages/core/src/hooks/import/index.tsx#L102-L110The
useImport
inantd
has it, but since the core is missing it, the additional data provider is failing to work correctly even when using antd https://github.com/pankod/refine/blob/c1908141d25e38bbd67aa3e9eb755bf538369aba/packages/antd/src/hooks/import/index.tsx#L31-L40