fix: Prevent crashes from View.refresh#3059
fix: Prevent crashes from View.refresh#3059NeloBlivion wants to merge 10 commits intoPycord-Development:masterfrom
View.refresh#3059Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3059/head:pr-3059
git checkout pr-3059This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3059/head |
Paillat-dev
left a comment
There was a problem hiding this comment.
(I am nitpicking, pr lgtm di per se)
|
Oh and changelog |
| return self | ||
|
|
||
| def refresh(self, interaction: Interaction, data: list[ComponentPayload]): | ||
| def _refresh(self, interaction: Interaction, data: list[ComponentPayload]): |
There was a problem hiding this comment.
I'd add an overrideable alias from refresh to _refresh with a deprecation warning, although it's not strictly necessary, I'm sure some people used this method for whatever reason, and while it wasn't documented, it was in fact private.
There was a problem hiding this comment.
Because it wasn't documented I don't think a deprecation warning is necessary.
|
@Lumabots Can you run your test bot on this pr for some time or something like that ? |
yep |
|
@Lumabots You tested using views and stuff ? |
Yep, using view, timeout, persistent view replace item add item remove item etc |
|
In case you missed it @NeloBlivion I left a couple comments here |
| return self | ||
|
|
||
| def refresh(self, interaction: Interaction, data: list[ComponentPayload]): | ||
| def _refresh(self, interaction: Interaction, data: list[ComponentPayload]): |
There was a problem hiding this comment.
Because it wasn't documented I don't think a deprecation warning is necessary.
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Signed-off-by: Nelo <41271523+NeloBlivion@users.noreply.github.com>
Signed-off-by: Nelo <41271523+NeloBlivion@users.noreply.github.com>
Summary
Pycord currently has an issue with race conditions in views - sometimes when editing a message or interaction response, the gateway will receive said message's
MESSAGE_UPDATEfrom Discord and attempt to internallyrefreshthe view beforeViewStorehas updated.This is meant to be circumvented through
remove_message_tracking, but this is not possible in response edit scenarios where the library may not have knowledge of the relevantmessage_idbeforehand.This PR:
_original_responsethat's now returned from all interactionslogging.warningI'm not certain if the first change is entirely appropriate - if this happens to target the wrong message, I will instead revert that specfic change.
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.