Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Fix prompt being shown twice (#96) #102

Merged
merged 1 commit into from Nov 14, 2023
Merged

Fix prompt being shown twice (#96) #102

merged 1 commit into from Nov 14, 2023

Conversation

thenoseman
Copy link

@thenoseman thenoseman commented Nov 14, 2023

Reason (as I can see it):
The interpolation of the request params is done twice. Both interpolations were called using the context RENDER_PURPOSE_RENDER which triggers the prompt in local-template-tags.ts.
This file contains the "prompt" function as a plugin. context.app.prompt is called there without checking for the already set cached value when context === "send".

This "fix" renders the first time with renderPurpose set to "no-render" so no prompt is called in this case since no plugins (the "prompt") are called anyway.

This might have side effects I have not encountered so far!

Closes #96

ps. A version for mac (universal) that incorporates this fix is here: https://github.com/thenoseman/insomnium/releases/tag/fix-double-prompt-test-release

This is just for testing purposes and should not be used longterm!

Reason (as I can see it):
The interpolation of the request params is done twice.
Both interpolations were called using the context RENDER_PURPOSE_RENDER which triggers
the prompt in `local-template-tags.ts`.
This file contains the "prompt" function as a plugin.
`context.app.prompt` is called there without checking for the already set cached value when context === "send".

This "fix" renders the first time with renderPurpose set to "no-render" so no prompt is called in this case since no
plugins (the "prompt") are called anyway.
@archywillhe
Copy link
Member

thanks! sounds good

@archywillhe archywillhe merged commit 8e562eb into ArchGPT:main Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promt show up twice?
3 participants