Function passing not working?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 166
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to do something sort of complicated on my site (basically work around #66) using the function passing capability, but it doesn't seem to be working for me. I simplified it down to a minimal form. I have this global data file cachetest.js:
import Fetch from "@11ty/eleventy-fetch"
export default async function() {
return await Fetch(async () => {
console.log("Cache miss")
return {
foo: "bar"
}
}, {
requestId: "cachetest",
duration: "1h"
})
}
Each time I run it logs "Cache miss" to the shell output. Never does it seem to write anything to .cache. Have I done something wrong here?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal example in cachetest.js and the function-passing behavior exposed by @11ty/eleventy-fetch. Run it repeatedly while checking whether .cache is written and whether “Cache miss” appears each time. Done means the supplied function honors requestId and duration so repeated runs use the cached result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100