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

fix(file-upload): race condition caused by not awaiting a DB promise #390

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

yong-jie
Copy link
Member

Problem

Replace file does not update the file extension in the UI.

Closes #261

Solution

There was a race condition between the server-side update of the longUrl and the subsequent retrieval of all urls made by the client.

Because we did not await the promise, it returns a success to the client very early (before the update operation completes in the database). This prompts the client to initiate its next step: retrieve all urls and update its redux state. Because the database update operation isnt completed yet, the server returns the old state of urls, causing this bug.

The fix was to await the promise.

@liangyuanruo liangyuanruo merged commit 6757ead into develop Aug 11, 2020
@liangyuanruo liangyuanruo deleted the filetype-ui-bug branch August 11, 2020 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace file operation does not update long URL in the UI
2 participants