Nunjuck Tag Performance enhance in editor[INS-4243]#7922
Conversation
|
Cool PR, but its my understanding there are already two renderContext caches that exist in the code. Would this be adding a third? Edit I tihnk there is one but it doesn't look well written, take a look and check it doesn't conflict or flight the cache you are introducing. |
4ebf032 to
9abb38d
Compare
| render: HandleRender, | ||
| mark: CodeMirror.TextMarker<CodeMirror.MarkerRange>, | ||
| text: string, | ||
| renderContext: HandleGetRenderContext | Awaited<ReturnType<HandleGetRenderContext>>, |
gatzjames
left a comment
There was a problem hiding this comment.
I left a comment suggesting some minor optimizations that are not blocking for this PR. Overall, the code looks good. However, the cache implementation is somewhat unclear. It would be beneficial to add documentation to explain how the cache works. This will help make future updates to the code-editor/nunjucks rendering easier to manage, given its current complexity.
packages/insomnia/src/ui/components/modals/workspace-environments-edit-modal.tsx
Outdated
Show resolved
Hide resolved
|
Add comment for the renderContextCache implementation reason and how it works |
|
In the comment of how it works could you also include some indications about the cache lifespan, setting and invalidation mechanism. That way it might be easier to reason about how it might interact with other parts. |
Great idea. Commit a new change so that the cached RenderContext will be shared between render and renderContext function in nunjuck-tags rendering. |
* add a warning message suggesting user to user after-script response to save response body as environment variable
9754b80 to
c757e99
Compare
Background
Before the after-response script feature, users are using response tag to save response body as environment variable.
Due to the limitation of current Nunjuck-tag design, for every response tag used in environment variable, we will send a separate request if the response meets re-send condition during the request sending process.
For legacy users using numbers of response tag as environment variable, they will find it very slow on sending requests even they do not use that environment variable.
We will add a warning message when users are editing environments and response tag is found as a variable value which suggests users to use after-response script instead.
Changes:
before.mp4
after.mp4
Ref: [INS-4243] #4645