gridsome-plugin-flexsearch
gridsome-plugin-flexsearch copied to clipboard
Support function in autoFetch
I try to keep everything as is, and only support function for now.
Because I cant think of a solid way to support both normal string and regex string without introducing too much headaches.
Also I use both to
and from
params from afterEach()
so we can have more flexibilities when writing the autoFetch()
function.
Thanks @louis-l - have you tested this out by building the Gridsome site in production mode, and deploying it? I'm not sure whether this implementation will work, due to the fact that Gridsome passes the options to the client as a JSON object, so anything like functions will be stripped out.
We should be able to support regex though, as long as it is wrapped in quotes, then passed to .match
. We will also need to add a new option (like autoFetchRegex
) otherwise it will count as a string and match the if (typeof autoFetch === 'string' || typeof autoFetch === 'object')
check.
Thanks @thetre97,
I have not tested it in production, but you are right.
I have updated to use autoFetchRegex
instead.
Nice - LGTM! I'll check it out soon.