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

Simplifies setData extensions #38

Merged
merged 2 commits into from
Jul 12, 2024
Merged

Simplifies setData extensions #38

merged 2 commits into from
Jul 12, 2024

Conversation

vishnuravi
Copy link
Member

@vishnuravi vishnuravi commented Jul 11, 2024

Simplifies setData extensions

♻️ Current situation & Problem

This setData extensions can be simplified to remove the continuations as the Firebase SDK now provides an async function for saving a dictionary to Firestore. This may also resolve the bug reported in #37, as the continuation is now removed.

⚙️ Release Notes

Updates the setData extensions to use the async function as described above.

📚 Documentation

The function signatures are unchanged and no changes to documentation are required.

✅ Testing

Additional tests have been added.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.02%. Comparing base (00ff0db) to head (fe55d5b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
+ Coverage   61.39%   63.02%   +1.63%     
==========================================
  Files          19       19              
  Lines        1155     1122      -33     
==========================================
- Hits          709      707       -2     
+ Misses        446      415      -31     
Files Coverage Δ
.../SpeziFirestore/DocumentReference+AsyncAwait.swift 58.34% <66.67%> (+30.27%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00ff0db...fe55d5b. Read the comment docs.

@vishnuravi vishnuravi marked this pull request as ready for review July 11, 2024 22:22
@PSchmiedmayer PSchmiedmayer added the bug Something isn't working label Jul 12, 2024
Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good to me; thank you @vishnuravi for the simplification here!

@PSchmiedmayer PSchmiedmayer linked an issue Jul 12, 2024 that may be closed by this pull request
1 task
@vishnuravi vishnuravi changed the title Updates setData extensions Simplifies setData extensions Jul 12, 2024
@vishnuravi vishnuravi merged commit 67981d0 into main Jul 12, 2024
8 checks passed
@vishnuravi vishnuravi deleted the update-setdata branch July 12, 2024 19:30
@PSchmiedmayer
Copy link
Member

Thank you @vishnuravi for the added tests!

@Supereg
Copy link
Member

Supereg commented Aug 13, 2024

Was there any more detail why this crash occurred. Particularly the crash message would be interesting.
I'm currently trying to make these methods concurrency safe and easiest solution would be to bring back the continuation-based approach of wrapping the Firebase setData(from:encoder:completion:) methods. This ensures that the from argument never leaves the isolation from the caller. Currently it does which might introduce race conditions or requires the type to conform to Sendable.
Another solution would be to inherit isolation (see SE-0420). However then sending the encoded dictionary produces currently a Sendable warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Crash when attempting to save data to Firebase
3 participants