question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] refreshButton is asking for default dataProvider

See original GitHub issue

Describe 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. image

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:closed
  • Created a year ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
KrishnaPGcommented, Jul 12, 2022

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. The RefreshButton is also picking up the correct data provider etc.

1reaction
KrishnaPGcommented, Sep 14, 2022

Looks like the dataProviderName is missing in the useImport of the core module: https://github.com/pankod/refine/blob/c1908141d25e38bbd67aa3e9eb755bf538369aba/packages/core/src/hooks/import/index.tsx#L102-L110

The useImport in antd 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found