From ca477665837402e7618460e3ec8daff9c698a7d0 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 16 Feb 2025 15:16:43 +0000 Subject: [PATCH 1/2] fix ol --- src/textual/widgets/_option_list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textual/widgets/_option_list.py b/src/textual/widgets/_option_list.py index 061a39885c..ba14aa7068 100644 --- a/src/textual/widgets/_option_list.py +++ b/src/textual/widgets/_option_list.py @@ -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 @@ -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: From 9d6e31ae702ff31d11cc7bee3071984c6dbcd24d Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 16 Feb 2025 15:17:58 +0000 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e18063963d..353faf3e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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