using ref to track the download state change instead of a state variable #8270
+11
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
Fix for the issue : #8239
This issue was not specific to Kanban view, it was happening for me for all the views and all the tables, but only when i fresh login and try to export
Steps to reproduce
Issue
This PR addresses a bug where downloads were being triggered twice when the download button was initially clicked. The redundant triggering stemmed from asynchronous state changes (isDownloading, loading, and inflight) that caused the useEffect hook to execute multiple times unintentionally.
noticed that the isDownloading state variable is not setting correctly that was the root cause for the file getting downloaded twice
line number 122 in useRecordData hook this condition was getting false
if (!isDownloading || inflight || loading)
twice because of the isDownloading state not getting reset correctly in thecomplete
function ( possibly its a stale closure )Solution
To resolve this, a ref
downloadingRef
was introduced to act as a controller for the download process:Thank you for considering this contribution! I look forward to your feedback.