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.

Not all tabs are always rendered in a tabset

See original GitHub issue

I believe this is related to a certain DOM structure which I haven’t been able to nail down yet. What I do see is that TabSet.updateVisibleTabs is called after mount but this component has not yet been given a non-empty (0, 0, 0, 0) rect. When render is called on TabSet, it still has this.hideTabsAfter as 0 even this, when render is called, the rect has been correctly set on the TabSetNode.

So between didMount (where updateVisibleTabs is called) and render the rect is set correctly but updateVisibleTabs is not set when the rect is updated. I have a temporary workaround but it’s not suitable for a PR as I’m sure there is a more elegant way to resolve this

const TabSet = require('flexlayout-react/lib/view/TabSet').TabSet;

// the tabset doesn't get it's dimensions depending on the container dom
// this patch ensures that it gets the correct dimensions (and renders the appropriate tabs)
function patchFlexLayout() {
  const _render = TabSet.prototype.render;
  TabSet.prototype.render = function() {
    if (!this.updatedAfterVisible) {
      const rect = this.props.node.getRect();
      if (rect.width > 0) {
        this.updatedAfterVisible = true;
        this.recalcVisibleTabs = true;
        this.updateVisibleTabs();
      }
    }
    return _render.call(this);
  };
}
patchFlexLayout();

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
nealuscommented, May 29, 2020

Hi Joe, I was able to recreate the issue and have added a fix in 0.3.10

0reactions
jhudson8commented, May 29, 2020

@nealus FWIW I ended up experiencing another bug after I added the monkey patch listed in the description where sometimes this.toolbarRef was undefined. I’m not quite sure why that would be happening but I did have to also add this to completely resolve my issue

    TabSet.prototype.updateVisibleTabs = function () {
      if (this.toolbarRef.current) {
        _updateVisibleTabs.call(this);
      }
    };
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tabsets not rendering datatables properly for Quarto Revealjs ...
I am making a presentation in Quarto using Revealjs. I would like each slide to contain a panel-tabset with multiple tabs, each containing...
Read more >
Shinydashboard: render only the clicked tab - shiny
Hello. I am working on shinydashboard app with multiple tabs & I would like to render the tab content only when it is...
Read more >
lightning-tabset - documentation - Salesforce Developers
A lightning-tabset displays a tabbed container with multiple content areas, only one of which is visible at a time. Tabs are displayed horizontally...
Read more >
Conditional Rendering on component in drawer not picking up ...
Within the drawer is a tabset that contains a tab that is conditionally rendered. Currently when the drawer displays, the tab is always...
Read more >
3.1 HTML document | R Markdown: The Definitive Guide
You can organize content using tabs by applying the .tabset class attribute to headers within a document. This will cause all sub-headers of...
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