Skip to content

Tabs: do not render inactive panelsΒ #473

@tanguilp

Description

@tanguilp

Hi there,

Was working with tabs and got the following problem: I have 3 tabs with 3 different URIs (let's call them A, B, C) and 3 different actions. I'm using push_patch to switch between them and still have nice URIs and not duplicate heex code.

The problem is that, depending on the current tab (A, B or C), I load, or I don't load, some data.

For instance, when I'm on tab B, I don't load data for tab A:

<:panel>
  <p>{render(@data_for_tab_a)}</p>
</:panel>
<:panel>
  <p>{render(@data_for_tab_b)}</p>
</:panel>

However, when I'm on tab B, because the first panel is rendered it requires @data_for_tab_a which is inefficient (and in my case causes crash because I do not load it).

I think we should disable rendering for tabs that are not active, even though I doubt it's possible with the current architecture (using javascript if I recall correctly).

Cheers, and I hope the best for you guys for the coming weeks ❀️

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions