falcor icon indicating copy to clipboard operation
falcor copied to clipboard

Can't delete all elements with a falcor call

Open emilgoldsmith opened this issue 9 years ago • 4 comments

When implementing a falcor call, falcor will timeout if you don't return any path-value objects. But in my case I for example have a function (in a newspaper website) called updateAuthors, which gets a new array of the authors of an article and then updates the values accordingly. Right now if that update is removing all authors, falcor will timeout as there won't be any new values returned, just an invalidate.

As my falcor call implementation is also what updates the database it would be stupid if I had to rewrite that code in the app part of my code in the special case someone wants to delete all the authors of an article temporarily (or other cases where I want to return nothing after an update).

Is it because I'm using bad form by returning invalidated: true on all of that, and should instead for every single value return a null value or undefined or something along the likes of that?

The only (extremely hacky) solution I can think of right now is to make a bogus path "placeholder" or whatever, and make all my call functions update that one.

emilgoldsmith avatar Oct 06 '16 12:10 emilgoldsmith

You should be able to return just invalidations in response to a call, without any path values. We did have a bug at one point, which didn't handle this case correctly, but I believe the issue should be fixed: https://github.com/Netflix/falcor/issues/589#issuecomment-164892770

If you can provide some more repro context, we can figure out where the disconnect may be.

sdesai avatar Nov 02 '16 22:11 sdesai

Okay I'll update to the newest falcor version, check it out and get back to you when I've checked if that solves it. Thanks.

emilgoldsmith avatar Nov 12 '16 17:11 emilgoldsmith

Sorry for being slow @sdesai I have the newest version of falcor 0.1.17 and I still do have this error.

const results = [
            {
              path: ['placeholder'],
              value: 'placeholder',
            },
            {
              path: ['issuesByNumber', issueNumber, 'categories'],
              invalidated: true,
            },
          ];
          resolve(results);

works but without the setting the value of the placeholder the call times out.

And my call looks like model.call([pathArray], [one argument], [], []).then()...

emilgoldsmith avatar Nov 26 '16 09:11 emilgoldsmith

I'm currently performing issue triage as we get ready to perform a proper release, and closing/tagging as I go.

We'll look into this one further soon.

steveorsomethin avatar Aug 07 '17 19:08 steveorsomethin