When a user logs in, and they do not have an index.json file in their S3 bucket (or they are new, and have no S3 bucket at all), the snippet list option in the app menu should not expand (or should be disabled).
Current Behavior
Currently, if a user logs in and they do not have an index.json file, the following XHR request is performed:
And when they expand their "My Snippets" option, they get an infinitely long empty list:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>Hopding/index.json</Key><RequestId>D4B75D9E07E90D9B</RequestId><HostId>227x9z160TTI1aRFELNU115TsDji6/FLuYidrd5hsROou0eA4D3QJBz0BVvw6Ra0n9vgIg1x/NE=</HostId></Error>
This is not properly handled anywhere, and seems to be causing the infinite empty list.
Steps to Reproduce (for bugs)
Remove your index.json file from the dev S3 bucket.
Log out of Codesplain.
Log in to Codesplain.
Expand your "My Snippets" list.
Possible Solution
Perhaps search the response body for <Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message>, and throw an error if it exists in the body, thus jumping into the catch statement of the Promise chain.
Expected Behavior
When a user logs in, and they do not have an
index.json
file in their S3 bucket (or they are new, and have no S3 bucket at all), the snippet list option in the app menu should not expand (or should be disabled).Current Behavior
Currently, if a user logs in and they do not have an
index.json
file, the following XHR request is performed:And when they expand their "My Snippets" option, they get an infinitely long empty list:
This is because the axios call that requests their
index.json
file does not actually fail, as one would expect: https://github.com/maryvilledev/codesplainUI/blob/master/src/actions/user.js#L48. Instead, it succeeds with a 200 status code, but the body of the response is:This is not properly handled anywhere, and seems to be causing the infinite empty list.
Steps to Reproduce (for bugs)
index.json
file from the dev S3 bucket.Possible Solution
Perhaps search the response body for
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message>
, and throw an error if it exists in the body, thus jumping into thecatch
statement of the Promise chain.