These are chat archives for WP-API/node-wpapi

3rd
Mar 2017
ajv
@andreasvirkus
Mar 03 2017 15:03
I'm polling for data every 20 seconds in a staging environment but node-wpapi seems to only access Wordpress on the first request
and return cached results after?
Can I somehow force a new lookup on the REST API side?
ajv
@andreasvirkus
Mar 03 2017 15:35
using superagent's superagent-no-cache module fails because of a dependency to component-ie which needs document apparently...
/code/wp-api-poc/node_modules/component-ie/index.js:16
           el = document.createElement('b'),
                ^

ReferenceError: document is not defined
K Adam White
@kadamwhite
Mar 03 2017 15:43
Hmm. I haven’t tried that module; you should be able to spoof the document in a Node environment using jsdom, just assign global.document = somewhere before you initialize
but there is no built-in caching within the library so I don’t know why you’d be getting cached results anyway
@andreasvirkus You’re not using some sort of in-memory cache? Just the wpapi module on its own, calling wp.[handler]()… etc?
ajv
@andreasvirkus
Mar 03 2017 15:46
Just the module yup
K Adam White
@kadamwhite
Mar 03 2017 15:46
Hmm. If you can share an example of the request loop that’s returning cached results as a github issue, I can try to dive into it with you
ajv
@andreasvirkus
Mar 03 2017 15:46

but there is no built-in caching within the library so I don’t know why you’d be getting cached results anyway

oh... :confused:

K Adam White
@kadamwhite
Mar 03 2017 15:46
yeah, I’ve not encountered that problem you describe :/
ajv
@andreasvirkus
Mar 03 2017 15:48
what would have to be included in the issue? gists of the files included?
mind if I just post the gists here?
K Adam White
@kadamwhite
Mar 03 2017 15:48
That’s certainly the most helpful (though obviously redact any passwords or servers you want to keep private!)
You can post them here but it’s easier for me to follow up if they’re linked from an issue
ajv
@andreasvirkus
Mar 03 2017 15:49
alright, will do
K Adam White
@kadamwhite
Mar 03 2017 15:49
:+1:
ajv
@andreasvirkus
Mar 03 2017 15:58
@kadamwhite WP-API/node-wpapi#298
K Adam White
@kadamwhite
Mar 03 2017 16:03
@andreasvirkus responded: WP-API/node-wpapi#298
I think that the requests are only being initiated once
I suggested a solution
ajv
@andreasvirkus
Mar 03 2017 16:04
ah excellent! I was afraid it was the requests file and my shortcoming of understanding Promises :laughing:
will test in a second
K Adam White
@kadamwhite
Mar 03 2017 16:05
Awesome! I left one other comment about promises here: WP-API/node-wpapi#298
ajv
@andreasvirkus
Mar 03 2017 16:15
awesome-sauce! closed the issue
thanks and sorry for bothering :D
K Adam White
@kadamwhite
Mar 03 2017 16:15
Not a bother, I’m glad it worked out!
thanks for asking