mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-25 02:23:04 +00:00 
			
		
		
		
	copy over original row position for dynamic items
This commit is contained in:
		| @@ -615,16 +615,15 @@ class ViewStore: | |||||||
|  |  | ||||||
|         view = View.from_message(interaction.message, timeout=None) |         view = View.from_message(interaction.message, timeout=None) | ||||||
|  |  | ||||||
|         base_item_index: Optional[int] = None |         try: | ||||||
|         for index, child in enumerate(view._children): |             base_item_index, base_item = next( | ||||||
|             if child.type.value == component_type and getattr(child, 'custom_id', None) == custom_id: |                 (index, child) | ||||||
|                 base_item_index = index |                 for index, child in enumerate(view._children) | ||||||
|                 break |                 if child.type.value == component_type and getattr(child, 'custom_id', None) == custom_id | ||||||
|  |             ) | ||||||
|         if base_item_index is None: |         except StopIteration: | ||||||
|             return |             return | ||||||
|  |  | ||||||
|         base_item = view._children[base_item_index] |  | ||||||
|         try: |         try: | ||||||
|             item = await factory.from_custom_id(interaction, base_item, match) |             item = await factory.from_custom_id(interaction, base_item, match) | ||||||
|         except Exception: |         except Exception: | ||||||
| @@ -634,6 +633,7 @@ class ViewStore: | |||||||
|         # Swap the item in the view with our new dynamic item |         # Swap the item in the view with our new dynamic item | ||||||
|         view._children[base_item_index] = item |         view._children[base_item_index] = item | ||||||
|         item._view = view |         item._view = view | ||||||
|  |         item._rendered_row = base_item._rendered_row | ||||||
|         item._refresh_state(interaction, interaction.data)  # type: ignore |         item._refresh_state(interaction, interaction.data)  # type: ignore | ||||||
|  |  | ||||||
|         try: |         try: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user