feat: add warning if crud transactions are not completed #64
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.
Description
This implements the same change from the JS SDK powersync-ja/powersync-js#254 where a warning is added to notify users that the crud transaction has not yet been completed.
Work Done
nextCrudItem
functionuploadAllCrud
function to usenextCrudItem
with a check for uncompleted crud transactionuploadCrudBatch
to this:
Testing
Added some unit tests, although they will need to be improved in future as they currently check for log output which is not ideal.
Unsure on how to reproduce this in the demo, however, the image below shows that the error would show (this happened when changing
nextCrudItem.clientId == checkedCrudItem?.clientId
tonextCrudItem.clientId != checkedCrudItem?.clientId
). I have run the app and uploads are working as expected.Nevermind this was due to a logic error:
This is currently happening in the demo and may be related to a bug I am busy diagnosing