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

File contents empty after approving new label #6

Open
dumazy opened this issue Nov 10, 2022 · 0 comments
Open

File contents empty after approving new label #6

dumazy opened this issue Nov 10, 2022 · 0 comments

Comments

@dumazy
Copy link

dumazy commented Nov 10, 2022

Version: 1.0.11-alpha.0

We have a project with three languages (en as default, nl and fr). After we approved a new label and downloading the files with the following code:

for (const language of ['en','nl','fr']) {
  const contents = await api.getFileContents({
      projectId: ourProjectId,
      fileId: fileId,
      lang: language,
    });
  const json = await contents.text();
}

The first two requests always return an empty json object {}. The third request will have the labels.
I noticed that adding a timeout between the requests helps, as the second request will already have the labels as one. Switching the order of the requested languages doesn't make a change.
I think that the getFileContents notices that the files are outdated and returns an empty json object while generating the new files. If these updated files are ready by the time the other requests come in, they'll receive the correct, updated contents.

I haven't tested if this is the same when calling the HTTP endpoints directly instead of through this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant