Closed csansoon closed 3 weeks ago
Latest commit: 40017c39b6d6aeb8c3dc94c3406512daa86c4104
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Describe your changes
Some procedures require extracting metadata from the query, like the defined configuration or knowing which functions are being used, without actually having to resolve the query.
The current way to do this is just compiling the query, which will return some additional metadata along with other compiled output. The problem with this approach is that compiling a query is not always free, as some queries may use
runQuery
. This function is executed in compile time, since we need the result to be able to resolve other parts of the query. Since we need to get some of the query metadata instantly in some cases, we cannot depend on running queries just to read its configs.To fix this issue, I have divided the current compilation process in two independent functions:
compile
andreadMetadata
:compile
resolves all variables, parameters and functions in a query, which are dynamic and dependent on context and may take some time depending on its content.readMetadata
in the other hand, returns information that is static in the query, like the defined configuration or the methods that are being called inside of it.In order to read something as "metadata", it must be static and not depend on other values, parameters or functions resolved during run-time. Since I want the config to be part of the query metadata, I had to add these restrictions to the
{@config}
tag:{#if}
or{#each}
blocks.Checklist before requesting a review
π TRENECITO. π Previous station: #439 π Next station: #444