Skip to content

No content after refresh #475

Description

@KMika-Sages

When Im on different tab than first, when I refresh the page, there is weird error where no content on any tab is visible, and first tab is underlined as active.
image

As you can see in the picture there is content in console in third tab, but the panel is not active.
Can you give me inside on this?

I can share the code.

For url params i use use-query-params

Activity

  1. danez commented on Apr 27, 2022

    @danez
    Collaborator

    Can you please share an example? If I look at the code of the TabPanel this should not be possible.

  2. KMika-Sages commented on May 4, 2022

    @KMika-Sages
    Author

    `

    const FinanceTabPanel = (props: any) => {
    const { edges, financeCategories } = props
    const FINANCE_CATEGORIES: string[] = financeCategories
    
    const [tab, setTab] = useQueryParam("tab", withDefault(StringParam, FINANCE_CATEGORIES[0]))
    const selectedTabIndex = edges.map(panel => panel.node.financeTabId).indexOf(tab)
    
    const handleTabChange = (newTabIndex: number) => {
        if (newTabIndex !== selectedTabIndex) {
            setTab(FINANCE_CATEGORIES[newTabIndex])
        }
    }
    
    return (
        <section className="finance-section">
            <div className="tab-panel_wrapper">
                <Tabs selectedIndex={selectedTabIndex} onSelect={handleTabChange}>
                    <TabList>
                        {edges.map((tab: FinancePropsProperties, idx: number) => (
                            <Tab key={idx}>{tab.node.financeTabName}</Tab>
                        ))}
                    </TabList>
    
                    {edges.map((tab: FinancePropsProperties, index: number) => (
                        <TabPanel key={index}>
                            <FinanceTarget props={edges[index]} />
                            {tab.node?.trainingITTopics ? (
                                <OpenTrainingsTopics props={edges[index]} />
                            ) : (
                                <React.Fragment />
                            )}
                            {tab.node?.financeApplicationTitle ? (
                                <FinanceApplication props={edges[index]} />
                            ) : (
                                <React.Fragment />
                            )}
                            {tab.node?.recruitment ? <Recruitment props={edges[index]} /> : <React.Fragment />}
                            {tab.node?.financeDownloadableFiles ? (
                                <DownloadFiles props={edges[index]} />
                            ) : (
                                <React.Fragment />
                            )}
                            {tab.node?.informationReference ? (
                                <InformationReference props={edges[index]} />
                            ) : (
                                <React.Fragment />
                            )}
                        </TabPanel>
                    ))}
                </Tabs>
            </div>
        </section>
    )
    

    }
    `

  3. KMika-Sages commented on May 6, 2022

    @KMika-Sages
    Author

    Can you please share an example? If I look at the code of the TabPanel this should not be possible.

    And if you want live example then go https://www.sages.pl/blog
    Choose tab different than first and refresh page

  4. xSyki commented on Sep 5, 2022

    @xSyki

    @danez I had the same problem. Updating to a new version of react-tabs and react helped. I think you can close this issue.

  5. joaobarbosaap commented on Sep 8, 2022

    @joaobarbosaap

    Looks like your problem is related with your application state, when I refresh your website after your example I can see a blank screen, but if you check the UI, you will notice that the first tab is selected, and your URL is requesting the data for another tab, so you need to sync your tab with your current URL in order to fix it.

  6. Uzayry42 commented on Jan 2, 2025

    @Uzayry42

    Looks like your problem is related with your application state, when I refresh your website after your example I can see a blank screen, but if you check the UI, you will notice that the first tab is selected, and your URL is requesting the data for another tab, so you need to sync your tab with your current URL in order to fix it.

    how do i do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions