Improve calls to cached get_prompt()#1688
Merged
rolandwalker merged 1 commit intomainfrom Mar 8, 2026
Merged
Conversation
No correctness or security issues stood out in the introduced changes. I couldn’t run the test suite in this environment because |
scottnemes
approved these changes
Mar 7, 2026
app.render_counter can't be used on a fresh app from get_app(), because for that instance, the counter starts again at zero. Instead, use the application stored at self.prompt_app.app. The only reason that was not used in the first place is that the tests were brittle. Some None checks and an additional property are enough to work around that. This ought to improve the refresh of some format strings in the toolbar, and it is listed that way in the changelog, but it hasn't been caught in the act at the feature level.
fd4a519 to
2bf219b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
app.render_countercan't be used on a fresh app fromget_app(), because for that instance, the counter starts again at zero. Instead, use the application stored atself.prompt_app.app.The only reason that was not used in the first place is that the tests were brittle. Some
Nonechecks and an additional property are enough to work around that.This ought to improve the refresh of some format strings in the toolbar, and it is listed that way in the changelog, but it hasn't been caught in the act at the feature level, so there isn't a screenshot.
However, it was verified that
render_counterstarts again from zero on a fresh app, which would break the caching onget_prompt().Checklist
changelog.mdfile.AUTHORSfile (or it's already there).