Skip to content
Merged

fix ol #5540

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.0.2

### Fixed

- Fixed OptionList.add_options exhausting iterator https://github.com/Textualize/textual/pull/5540

## 2.0.1 - 2024-02-16

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion src/textual/widgets/_option_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ def add_options(self, new_options: Iterable[OptionListContent]) -> Self:
new_options: Content of new options.
"""

new_options = list(new_options)

option_ids = [
option._id
for option in new_options
Expand All @@ -330,7 +332,6 @@ def add_options(self, new_options: Iterable[OptionListContent]) -> Self:
"New options contain duplicated IDs; Ensure that the IDs are unique."
)

new_options = list(new_options)
if not new_options:
return self
if new_options[0] is None:
Expand Down
Loading