Improve upload data behavior details + cross-reference sdk pages#390
Improve upload data behavior details + cross-reference sdk pages#390joshuabrink wants to merge 2 commits intomainfrom
Conversation
| 1. [PowerSyncBackendConnector.fetchCredentials](https://github.com/powersync-ja/powersync-js/blob/ed5bb49b5a1dc579050304fab847feb8d09b45c7/packages/common/src/client/connection/PowerSyncBackendConnector.ts#L16) \- This method is automatically invoked by the PowerSync Client SDK to obtain authentication credentials. The SDK caches credentials internally and only calls this method when needed (e.g. on initial connection or when the token is near expiry). See [When `fetchCredentials()` is Called](/configuration/app-backend/client-side-integration#when-fetchcredentials-is-called) for details, and [Authentication Setup](/configuration/auth/overview) for instructions on how the credentials should be generated. | ||
| 2. [PowerSyncBackendConnector.uploadData](https://github.com/powersync-ja/powersync-js/blob/ed5bb49b5a1dc579050304fab847feb8d09b45c7/packages/common/src/client/connection/PowerSyncBackendConnector.ts#L24) \- Use this to upload client-side changes to your app backend. | ||
| \-> See [Writing Client Changes](/handling-writes/writing-client-changes) for considerations on the app backend implementation. | ||
| 2. [PowerSyncBackendConnector.uploadData](https://github.com/powersync-ja/powersync-js/blob/ed5bb49b5a1dc579050304fab847feb8d09b45c7/packages/common/src/client/connection/PowerSyncBackendConnector.ts#L24) \- This method will be automatically invoked by the PowerSync Client SDK whenever it needs to upload client-side writes to your app backend via your backend API. Therefore, in your implementation, you need to define how your backend API is called. See [When `uploadData()` is Called](/configuration/app-backend/client-side-integration#when-uploaddata-is-called) for details on triggers, throttling, and retry behavior, and [Writing Client Changes](/handling-writes/writing-client-changes) for considerations on the app backend implementation. |
There was a problem hiding this comment.
This reads a bit difficult: the second sentence doesn't quite follow from the first, I think what bothers me most is "in your implementation" - I think the link to uploadData is missing here.
This method will be automatically invoked by the PowerSync Client SDK whenever it needs to upload client-side writes to your app backend via your backend API. Therefore, in your implementation, you need to define how your backend API is called.
Do we overall just want to say that uploadData gets called automatically, and users must define the upload logic in it? Then something like this would flow better IMO (needs polished wording)
This method will be automatically invoked by the PowerSync Client SDK whenever it needs to upload client-side writes to your app backend (via your backend API). You need to define how writes are processed in this method.
|
|
||
| ## Writing Data (via SQLite Database and Upload Queue) | ||
|
|
||
| Any mutations on the SQLite database, namely updates, deletes and inserts, are immediately reflected in the SQLite database, and also also automatically placed into an **upload queue** by the Client SDK. |
There was a problem hiding this comment.
There's a typo caught by the mintlify job
Updates the documentation for all PowerSync client SDKs to provide clearer and more detailed guidance on how and when the
uploadData()method is called. It introduces links to a new or updated section explaining the triggers, throttling, retry behavior, and error handling associated withuploadData().