Skip to content

bug: Changing tooltip in before_update() does not work immediately #5746

@jnsh

Description

@jnsh

Duplicate Check

Describe the bug

Changing the tooltip value for a custom control in its before_update(), and calling update() for the control does not immediately change the tooltip in the UI. It is necessary to call update() for the tooltip to change in the UI.

Code sample

Code
import flet as ft

class CustomText(ft.Text):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.number = 0
        self.size = 42
        self.text_align = ft.TextAlign.CENTER

    def before_update(self):
        super().before_update()
        self.number += 1
        self.value=str(self.number)
        self.tooltip=str(self.number)

def main(page: ft.Page) -> None:

    number = CustomText(width=float("inf"))
    page.add(number)
    page.add(ft.TextButton(
        text="Click to increase number",
        on_click=lambda e: number.update(),
        width=float("inf")
    ))
    page.add(ft.Text(
        value="The number and its tooltip are set as the same value, but the tooltip is always one behind :(",
        text_align=ft.TextAlign.CENTER,
        width=float("inf")
    ))

ft.app(main)

To reproduce

  1. Create custom Flet control class
  2. In the custom class, add before_update() function that changes self.tooltip
  3. Call update() on the custom control
    -> Control's tooltip is not immediately updated, until you call update() the second time.

Expected behavior

Setting tooltip in before_update() should change it in UI immediately when update() is called, the same way it works for e.g. flet.Text.value

Screenshots / Videos

Captures
Screencast.From.2025-10-25.15-30-10.mp4

Operating System

Linux

Operating system details

Arch Linux

Flet version

0.28.3

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions