Skip to content

Commit 6f65f6a

Browse files
committed
Don't crash the browser as hard when loading a directory with more than 250 files
1 parent 5301ab4 commit 6f65f6a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

resources/scripts/components/server/files/FileManagerContainer.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,21 @@ export default () => {
7979
:
8080
<CSSTransition classNames={'fade'} timeout={250} appear={true} in={true}>
8181
<div>
82-
{
82+
{files.length > 250 ?
83+
<React.Fragment>
84+
<div className={'rounded bg-yellow-400 mb-px p-3'}>
85+
<p className={'text-yellow-900 text-sm text-center'}>
86+
This directory is too large to display in the browser, limiting
87+
the output to the first 250 files.
88+
</p>
89+
</div>
90+
{
91+
files.slice(0, 500).map(file => (
92+
<FileObjectRow key={file.uuid} file={file}/>
93+
))
94+
}
95+
</React.Fragment>
96+
:
8397
files.map(file => (
8498
<FileObjectRow key={file.uuid} file={file}/>
8599
))

0 commit comments

Comments
 (0)