Skip to content

Notifications not showing correctly in Posit Connect #1397

@SamEdwardes

Description

@SamEdwardes

Hey, Shiny team - I am having some troubles with notifications when deploying Shiny apps to Posit Connect:

  • Locally, the notification acts as expected. It shows up at the correct time, and is removed at the correct time.
  • When deployed to Connect, the notification does not show up. Instead, it flickers right before it is supposed to be removed.

I am not sure if I could be using notifications incorrectly (e.g., should it be in an "effect" function) or if something is going wrong when deployed to Connect.

Recording

When running locally, notifications work as expected:

shiny-notification-working-local.mp4

When deployed to Posit Connect, it flickers. The app starts at the 12 second mark. The notification should show up almost right after. Instead it flickers at around the 18 second mark.

shiny-notification-not-working-connect.mp4

Reprex

app.py

from time import sleep

import pandas as pd
from shiny import App, Inputs, Outputs, Session, render, ui

app_ui = ui.page_fluid(ui.p("Hello world"), ui.output_data_frame("my_data"))


def load_data() -> pd.DataFrame:
    sleep(6)
    return pd.DataFrame({"x": [1, 2, 3], "y": ["a", "b", "c"]})


def server(input: Inputs, output: Outputs, session: Session):
    print("Loading data...")
    notification_id = ui.notification_show("Loading data", duration=None)
    df = load_data()
    print("Loading data complete!")
    ui.notification_remove(notification_id)

    @output
    @render.data_frame
    def my_data():
        return render.DataGrid(df)


app = App(app_ui, server)

requirements.in

shiny==0.9.0
rsconnect-python==1.22.0
pandas==2.1.4

requirements.txt

# This file was autogenerated by uv via the following command:
#    uv pip compile requirements.in --output-file requirements.txt
anyio==4.3.0
    # via
    #   starlette
    #   watchfiles
appdirs==1.4.4
    # via shiny
asgiref==3.8.1
    # via shiny
click==8.1.7
    # via
    #   rsconnect-python
    #   shiny
    #   uvicorn
h11==0.14.0
    # via uvicorn
htmltools==0.5.1
    # via shiny
idna==3.7
    # via anyio
linkify-it-py==2.0.3
    # via shiny
markdown-it-py==3.0.0
    # via
    #   mdit-py-plugins
    #   shiny
mdit-py-plugins==0.4.0
    # via shiny
mdurl==0.1.2
    # via markdown-it-py
numpy==1.26.4
    # via pandas
packaging==24.0
    # via
    #   htmltools
    #   shiny
pandas==2.1.4
pip==24.0
    # via rsconnect-python
prompt-toolkit==3.0.36
    # via questionary
pyjwt==2.8.0
    # via rsconnect-python
python-dateutil==2.9.0.post0
    # via pandas
python-multipart==0.0.9
    # via shiny
pytz==2024.1
    # via pandas
questionary==2.0.1
    # via shiny
rsconnect-python==1.22.0
semver==2.13.0
    # via rsconnect-python
shiny==0.9.0
six==1.16.0
    # via
    #   python-dateutil
    #   rsconnect-python
sniffio==1.3.1
    # via anyio
starlette==0.37.2
    # via shiny
typing-extensions==4.11.0
    # via
    #   htmltools
    #   shiny
tzdata==2024.1
    # via pandas
uc-micro-py==1.0.3
    # via linkify-it-py
uvicorn==0.29.0
    # via shiny
watchfiles==0.21.0
    # via shiny
wcwidth==0.2.13
    # via prompt-toolkit
websockets==12.0
    # via shiny

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions