conradkohC
Convex Community2y ago
15 replies
conradkoh

Query functions caching fails when used with third party libraries

This is not strictly a bug with convex, but is common enough that many applications would run into this issue when trying to use any third party library, resulting in major cache misses that are only found after release.

Problem: Convex disables caching when the Date constructor is invoked. However, the date constructor is not always invoked by the dev, but could be by a third party library (such as date libraries that are used to parse and transform dates).
This results in the query being uncached and an elevated number of row reads.

Proposal: The build should fail if the a query uses the Date constructor, requiring the user to explicitly call a method ctx.disableCache() at the start of the query.
Was this page helpful?