Skip to content

Refactor the relationship between FileBrowser, various entry/upload views and their contexts

Refactoring logic along the lines suggested by #828 (closed). A central "store" is introduced, where components can subscribe to uploads or entries they are interested in. The subscriptions are done in useEffect (the way react recommend handling subscriptions). The components provide a callback function, which is called whenever the store upload object changes. The store is responsible for fetching data and notifying subscribers.

The store fetches data if it sees the need to. If an upload or entry is processing, it will poll once per second until it finishes processing, or no subscriber is interested in it anymore.

The file browser and the upload overview page use the store for synching. Making an update to the files on one of these pages and switching to the other should show an updated result, unlike before. Also removed the blocking dialogue saying that the upload is processing when an action is performed in the file browser. It's quite possible to browse while the upload is processing (if additional file operations are issued during processing, they should just be queued), and with the store, it's easy to make sure everything is updated when done.

Edited by David Sikter

Merge request reports