Skip to content

Commit a7a1cdb

Browse files
authored
Merge pull request #5540 from Textualize/fix-ol
fix ol
2 parents 732c6b9 + 9d6e31a commit a7a1cdb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## 2.0.2
9+
10+
### Fixed
11+
12+
- Fixed OptionList.add_options exhausting iterator https://github.com/Textualize/textual/pull/5540
13+
814
## 2.0.1 - 2024-02-16
915

1016
### Fixed

src/textual/widgets/_option_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ def add_options(self, new_options: Iterable[OptionListContent]) -> Self:
320320
new_options: Content of new options.
321321
"""
322322

323+
new_options = list(new_options)
324+
323325
option_ids = [
324326
option._id
325327
for option in new_options
@@ -330,7 +332,6 @@ def add_options(self, new_options: Iterable[OptionListContent]) -> Self:
330332
"New options contain duplicated IDs; Ensure that the IDs are unique."
331333
)
332334

333-
new_options = list(new_options)
334335
if not new_options:
335336
return self
336337
if new_options[0] is None:

0 commit comments

Comments
 (0)