Hey - I’m at my wits end with the Google Sheets integration, hoping someone might have a solution before I throw in the towel.
Basic goal
I have a user table in Google Sheets that syncs with Softr.
Users belong to a company, which is specified in the company_id column on the user table.
I can use the company_id field on the user table to filter related tables.
Users can be added from third-party tools.
Problem
When I create a user using Softrs API, I cannot initialize the company_id field. I can update the record manually or automatically through scripts, but Softr doesn’t fetch the updated record for several hours. Users can log in, but none of their company-specific data will load.
Is there a way to force the table to fetch updated data?
As an alternative option, I’ve written an API endpoint that validates the users Softr token and lets me fetch data directly. Unfortunately the window.logged_in_user object is refreshed on every new page, and the data blocks will only let me filter from this object. Is there an event I can use to update the user object for the entire session, or an eventListener I can use to update it on each new page load? Would this even solve my issue?
Thank you for bringing the issue to our attention.
Our team is already aware of this issue and is actively working on a solution. We understand how important this is, and we appreciate your patience as we strive to resolve it as quickly as possible.
I will keep you updated on our progress and notify you as soon as the issue is fixed.
I noticed that rows are rendered if they are inserted during the get-records event.
Suppose I used my API endpoint to fetch and insert the rows during the onRecords event, and the data was readonly. Anything I should be concerned about?
Are there any other login/auth/identity related hooks we can listen for other than the user-sign-out event? This is the only one I can find mentioned in the docs / on the community, but maybe I’ve missed something.
What worked for me was setting up a Google Apps Script to push updates directly to the API whenever something changes in Google Sheets. It saved me from waiting forever for things to sync.
As for the window.logged_in_user issue, you could try adding a custom event listener in your app to update the user object whenever the page reloads. It might take a bit of tinkering, but it could help keep everything up-to-date across sessions.
I’ve been stuck on stuff like this before and found some good ideas on Excel TV. They’ve got tips that have helped me figure out better workflows when things weren’t going smoothly.