Skip to content

Commit

Permalink
Merge branch 'main' into revive-codesandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
travis committed Jan 25, 2023
2 parents 614b129 + 6778d6c commit e570fdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions packages/react-uploads-list/src/UploadsList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { As, Component, Props, Options, RenderProp } from 'ariakit-react-utils'
import type { UploadsListContextState, UploadsListContextActions } from '@w3ui/uploads-list-core'

import React, { Fragment, createContext, useContext, useMemo, useCallback, useEffect } from 'react'
import React, { Fragment, createContext, useContext, useMemo, useCallback } from 'react'
import { createComponent, createElement } from 'ariakit-react-utils'
import { useUploadsList } from './providers/UploadsList'

Expand Down Expand Up @@ -68,10 +68,6 @@ export const UploadsListRoot = (props: UploadsListRootProps): JSX.Element => {
} else {
renderedChildren = children as React.ReactNode
}
useEffect(() => {
// load the first page of results asynchronously
void actions.next()
}, [])
return (
<UploadsListComponentContext.Provider value={contextValue}>
{renderedChildren}
Expand Down
5 changes: 4 additions & 1 deletion packages/react-uploads-list/src/providers/UploadsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, createContext, useState } from 'react'
import React, { useContext, createContext, useState, useEffect } from 'react'
import { UploadListResult, UploadsListContextState, UploadsListContextActions, ServiceConfig, list } from '@w3ui/uploads-list-core'
import { useKeyring } from '@w3ui/react-keyring'
import { list as uploadList } from '@web3-storage/capabilities/upload'
Expand Down Expand Up @@ -82,6 +82,9 @@ export function UploadsListProvider ({ size, servicePrincipal, connection, child
}
}

// we should reload the page any time the space or agent change
useEffect(() => { void loadPage() }, [space, agent])

return (
<UploadsListContext.Provider value={[state, actions]}>
{children}
Expand Down

0 comments on commit e570fdd

Please sign in to comment.