diff options
Diffstat (limited to 'src/web')
| -rw-r--r-- | src/web/src/components/System/Shares/ShareTable.js | 4 | ||||
| -rw-r--r-- | src/web/src/components/System/Shares/index.js | 16 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/web/src/components/System/Shares/ShareTable.js b/src/web/src/components/System/Shares/ShareTable.js index 095a8380..fd2c7623 100644 --- a/src/web/src/components/System/Shares/ShareTable.js +++ b/src/web/src/components/System/Shares/ShareTable.js @@ -35,8 +35,8 @@ const ShareTable = ({ shares, onClick }) => { <Icon name='folder'/> <Link to='#'>{share.localPath}</Link> </Table.Cell> - <Table.Cell>{share.directories}</Table.Cell> - <Table.Cell>{share.files}</Table.Cell> + <Table.Cell>{share.directories ?? '?'}</Table.Cell> + <Table.Cell>{share.files ?? '?'}</Table.Cell> <Table.Cell>{share.alias}</Table.Cell> <Table.Cell>{share.remotePath}</Table.Cell> </Table.Row>))} diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js index f4f9ac94..3d5b1858 100644 --- a/src/web/src/components/System/Shares/index.js +++ b/src/web/src/components/System/Shares/index.js @@ -24,21 +24,25 @@ const Index = ({ state = {} } = {}) => { const [modal, setModal] = useState(false); const { scanning, scanProgress, scanPending, directories, files } = state; - const scanned = !scanning; useEffect(() => { getAll(); }, []); useEffect(() => { - if (scanned) { - getAll(); + getAll({ quiet: true }); + + if (!scanning) { + // the state change out of scanning can fire before + // shares are updated, which leaves them stale. wait a second + // and fetch again. + setTimeout(() => getAll({ quiet: true }), 1000); } - }, [scanned]); + }, [scanning, scanPending]); - const getAll = async () => { + const getAll = async ({ quiet } = { quiet: false }) => { try { - setLoading(true); + if (!quiet) setLoading(true); const sharesByHost = await sharesLib.getAll(); const flattened = Object.entries(sharesByHost).reduce((acc, [host, shares]) => { |
