Skip to content

Remove dead done prop from carousel slides - #6184

Merged
falkoschindler merged 4 commits into
zauberzeug:mainfrom
evnchn:midnight/carousel-43
Jul 31, 2026
Merged

Remove dead done prop from carousel slides#6184
falkoschindler merged 4 commits into
zauberzeug:mainfrom
evnchn:midnight/carousel-43

Conversation

@evnchn

@evnchn evnchn commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Carousel._handle_value_change sets a :done prop on every slide on each value change, but Quasar's QCarouselSlide has no done prop — it's a dead no-op (copy-pasted from Stepper, where done is a real QStep prop).

Minimal reproduction (nicegui/elements/carousel.py:43):

from nicegui import ui
c = ui.carousel(value='a')
with c:
    ui.carousel_slide('a'); ui.carousel_slide('b')
c.value = 'b'                                   # fires _handle_value_change
print(any(':done' in s._props for s in c))      # True on origin/main -> dead attr on slides

True (a stray :done attribute Quasar ignores)

Implementation

Remove the dead _handle_value_change override. The base ValueElement._handle_value_change still syncs model-value, so selection behaviour is unchanged.

Dead-code provenance (git blame) & third-party safety
  • Origin: introduced with ui.carousel — Falko Schindler, decdf97 (2023-07-16). The done loop is copy-pasted from Stepper (where done is a real QStep prop); QCarouselSlide has never had one. So this is author-copy-paste-error, not a feature obsoleted by later changes.
  • Third-party side-effect check (does the :done write trigger a re-render that surfaces recently-added user content?): slide.props(':done=…') does call slide.update() when the done-state flips — but update() flushes only that slide element's own props (the inert :done attribute); it does not re-render children. Recently-added user content is surfaced independently: NiceGUI auto-enqueues the parent's update whenever a child is created (element.py:85,87enqueue_update(parent_slot.parent)). So removing this override cannot hide user content — confirmed by tracing the update path.
Verification
  • No pytest. The prop is inert, so removing it changes nothing observable — there is no user-visible behaviour for a test to guard. An earlier revision asserted on slide._props; per Prefer behavior tests over tests coupled to implementation details #6219 that is a test coupled to internals rather than to behaviour, so it was dropped.
  • Local gates: pre-commit · mypy ./nicegui · pylint 10.00/10 · pytest — all green.

Progress

  • The PR title is a short phrase starting with a verb.
  • The implementation is complete.
  • This PR does not address a security issue.
  • Pytests are not necessary.
  • Documentation is not necessary.
  • No breaking changes to the public API.

evnchn and others added 2 commits July 25, 2026 00:14
DateInput applied .props('no-parent-event') to the inner QDate, but
Quasar 2.18.5's QDate has no such prop (noParentEvent belongs to the
anchor-props mixin behind QMenu/QTooltip). It was an inert no-op
attribute; removing it changes no behavior (open/close is driven by the
parent QMenu).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
`Carousel._handle_value_change` was copy-pasted from `Stepper`, writing a
`:done` prop onto every slide on each value change. `QStepperStep` has a
`done` prop, but `QCarouselSlide` does not, so the loop only polluted each
slide's DOM with a stray, silently-ignored attribute. Removing the override
leaves the base `ValueElement._handle_value_change` (model-value sync)
untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@evnchn
evnchn marked this pull request as ready for review July 25, 2026 06:17
@evnchn evnchn added feature Type/scope: New or intentionally changed behavior review Status: PR is open and needs review labels Jul 26, 2026
@falkoschindler falkoschindler self-assigned this Jul 26, 2026
@falkoschindler
falkoschindler self-requested a review July 26, 2026 20:37
falkoschindler and others added 2 commits July 28, 2026 22:23
The carousel no longer sets a `:done` prop on its slides, and QCarouselSlide
has no such prop, so there is no observable behavior to guard. The test
asserted on `slide._props`, which no merged test in the suite does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@falkoschindler falkoschindler added this to the 3.16 milestone Jul 31, 2026
@falkoschindler
falkoschindler added this pull request to the merge queue Jul 31, 2026
Merged via the queue into zauberzeug:main with commit 855ced0 Jul 31, 2026
7 checks passed
@evnchn
evnchn deleted the midnight/carousel-43 branch July 31, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Type/scope: New or intentionally changed behavior review Status: PR is open and needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants