Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc Viewer shows "unable to fetch documents" error during initial load #913

Closed
chriswilty opened this issue Jul 3, 2024 · 1 comment · Fixed by #916
Closed

Doc Viewer shows "unable to fetch documents" error during initial load #913

chriswilty opened this issue Jul 3, 2024 · 1 comment · Fixed by #916
Assignees
Labels
bug Something isn't working frontend Requires work on the frontend triage New tickets to be checked by the maintainers

Comments

@chriswilty
Copy link
Member

chriswilty commented Jul 3, 2024

Bug report

Description

On opening the Document Viewer in sandbox, the available document list is fetched from the server. But while we wait for that to load, we see error message "Unable to fetch documents..." until the request completes. This is obviously misleading. Instead we should probably see a loading indicator, and an error message only if the request failed or returned with an empty document list.

Image

The problem is exacerbated because the component is unmounted on close, meaning a request is made every time the viewer is opened. We might therefore consider lifting the "available documents" state into a parent component, and passing it in as a prop. Currently the App component is the parent of the viewer, so the state would need to live there, and probably be fetched when Sandbox is first opened.

Alternatively, we could send the available documents list in the level data response. Level data are fetched from MainComponent rather than App, so the function to open the document viewer would need to be moved into there. This would be the more efficient solution.

Update
The "alternative" solution above will be implemented for reasons of efficiency.

Reproduction steps

Steps to reproduce the behaviour:

  1. Open the Sandbox level
  2. Click on View Documents in the left side panel
  3. Message is visible: "Unable to fetch documents ..."
  4. After a short pause, the above message is replaced by the first document.

Expected behaviour

Error message does not display on initial fetch; instead, a loading indicator is displayed if the docs request is in progress.

Acceptance criteria

GIVEN I am on Sandbox level
WHEN I open the Document Viewer
THEN the first document loads immediately

@chriswilty chriswilty added bug Something isn't working triage New tickets to be checked by the maintainers frontend Requires work on the frontend labels Jul 3, 2024
@chriswilty chriswilty self-assigned this Jul 8, 2024
@chriswilty
Copy link
Member Author

Deployed to remote, and it now works as expected 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Requires work on the frontend triage New tickets to be checked by the maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant