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

Incorrect sync order of related outbox items (sendAll) #94

Closed
tomaszn opened this issue Oct 19, 2017 · 3 comments
Closed

Incorrect sync order of related outbox items (sendAll) #94

tomaszn opened this issue Oct 19, 2017 · 3 comments

Comments

@tomaszn
Copy link
Contributor

tomaszn commented Oct 19, 2017

When sending pending items, ones that depend on ids of other items should be postponed until what they refer to got their ids. I managed to get the batches of model names this way:

all_ready = [];
fresh = [];
do {
  new_ready = Object.values(app.config.pages).filter(function(page) {
    return page['list'] && !page.form.some(function(field) {
      return field['wq:ForeignKey'] && all_ready.indexOf(field['wq:ForeignKey']) == -1;
    });
  }).map(function(page) { return page['name']; });
  fresh = new_ready.filter(model => all_ready.indexOf(model) == -1);
  console.log('time to sync items from these models:', fresh);
  all_ready = new_ready;
} while (fresh.length);

After every item is synced, fields of relating items should be updated with a a persistent id obtained from the server.

@tomaszn
Copy link
Contributor Author

tomaszn commented Oct 20, 2017

Related to #85.

@sheppard
Copy link
Member

I created a test case for this in 45cd0c3 and it seems to be working. Can you review and add more to the test, perhaps as part of #95?

I did find a bug while testing (see #102).

@sheppard sheppard added this to the 1.2 - Redux Integration milestone Apr 17, 2019
@sheppard
Copy link
Member

sheppard commented Aug 8, 2019

This should be working pretty well now - see notes in #95.

@sheppard sheppard closed this as completed Aug 8, 2019
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

2 participants