Update useCloudSave to expose a promise instead of polling
- 主要語言
- TypeScript
- 星號
- 6
- 分支
- 15
- 平均合併
- 7 天 22 小時
- 30 天內合併 PR
- 2
描述
https://github.com/aafre/resume-builder/pull/180#discussion_r2666410315
This while loop implements a polling mechanism to wait for the save operation to complete. While it's not a blocking busy-wait due to await, it's an inefficient pattern that can be improved.
A more robust and idiomatic approach would be for useCloudSave to expose a promise that resolves when the current save operation is finished. This would allow you to await that promise directly, avoiding the polling loop and making the code's intent clearer.
For example, useCloudSave could manage a saveInProgressPromise ref. Then you could simply do await cloudSaveHook.saveInProgressPromise; here.
Since this would require changes to useCloudSave, it could be a good follow-up task. The current implementation with saveStatusRef is a solid improvement to prevent stale closures.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。