Skip to content

Commit

Permalink
fix: UI issue when there were more than 100 features (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
novakzaballa authored Sep 6, 2023
1 parent ecb7fd2 commit c1a62ce
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 37 deletions.
101 changes: 78 additions & 23 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
"react-select": "2.4.3",
"react-sortable-hoc": "1.9.1",
"react-tooltip": "3.7.0",
"react-virtualized": "^9.22.5",
"react-virtualized-auto-sizer": "1.0.2",
"react-window": "^1.8.6",
"reactstrap": "9.0.1",
"recharts": "^2.1.14",
"redux-persist": "^6.0.0",
Expand Down
35 changes: 22 additions & 13 deletions frontend/web/components/PanelSearch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { FixedSizeList as List } from 'react-window'
import { AutoSizer, List } from 'react-virtualized'
import Popover from './base/Popover'
import Input from './base/forms/Input'
import Icon from './Icon'
Expand Down Expand Up @@ -91,20 +91,29 @@ const PanelSearch = class extends Component {
}

renderContainer = (children) => {
const renderRow = ({ index, style }) => (
<div style={style}>{this.props.renderRow(children[index])}</div>
)
const renderRow = ({ index, key, style }) => {
return (
<div key={key} style={style}>
{this.props.renderRow(children[index])}
</div>
)
}
if (children && children.length > 100 && this.props.itemHeight) {
return (
<List
style={{ overflowX: 'hidden' }}
height={this.props.itemHeight * 10}
itemCount={children.length}
itemSize={this.props.itemHeight}
width='100%'
>
{renderRow}
</List>
<div>
<AutoSizer disableHeight>
{({ width }) => (
<List
style={{ overflowX: 'hidden' }}
width={width}
height={this.props.itemHeight * 10}
rowCount={children.length}
rowHeight={this.props.itemHeight}
rowRenderer={renderRow}
/>
)}
</AutoSizer>
</div>
)
}
return children.map(this.props.renderRow)
Expand Down

2 comments on commit c1a62ce

@vercel
Copy link

@vercel vercel bot commented on c1a62ce Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c1a62ce Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-flagsmith.vercel.app
docs.flagsmith.com
docs-git-main-flagsmith.vercel.app
docs.bullet-train.io

Please sign in to comment.