这是indexloc提供的服务,不要输入任何密码
Skip to content

Dropdown with optionsEndpoint doesn't support real-time search - only loads options on initial render #7187

@nullgit

Description

@nullgit

Problem Description

I'm developing a stock selection dropdown component in OpenBB Workspace with type: "endpoint" and optionsEndpoint configuration, but I
found that the endpoint is only called during initial component render, not when users type search keywords.

Current Configuration

{
    "paramName": "symbol",
    "type": "endpoint",
    "value": "600519.SH",
    "label": "Select Stock",
    "placeholder": "Search and select stock",
    "required": True,
    "optionsEndpoint": "/stock_search_options",
    "optionsParams": {
        "query": "$symbol",
     },
    "enableSearch": True,
    "style": {
        "popupWidth": 450
    }
}

Endpoint Implementation

  @router.get("/stock_search_options")
  async def stock_search_options(
      query: str = Query("", description="Search keyword"),
      x_user_id: str = Header(alias="X-User-ID", default="")
  ):
      # Search stocks based on query parameter
      if not query.strip():
          # Return default stock list
          return default_stocks

      # Search using query
      search_results = await search_symbols_data_only(query)
      return format_options(search_results)

Behavior

Expected Behavior

  • When users type in the dropdown, it should trigger a request to /stock_search_options?query=user_input
  • The endpoint should receive the query parameter and return filtered options
  • The dropdown should update in real-time with search results

Actual Behavior

  • Only calls /stock_search_options (without query parameter) when component first renders
  • No new requests are made when users type search keywords
  • Real-time search functionality doesn't work
Image

Questions

  1. Does OpenBB Workspace support real-time search for dropdowns?
  2. If supported, what's the correct configuration?
  3. Is enableSearch an officially supported parameter?
  4. Are there alternative ways to implement dynamic dropdown search?

Environment

  • OpenBB Platform: local
  • OpenBB Workspace
  • Backend: FastAPI + Python

Reference Documentation

I referenced the documentation: openbb-docs/content/workspace/widget-parameters/advanced-dropdown.md, but couldn't find specific instructions for real-time search functionality.

Additional Context

The current implementation only loads options once on initial render. We need the dropdown to dynamically fetch filtered options based on user input for a better user experience, especially when dealing with large datasets like stock symbols.
Any guidance or documentation on the correct configuration format would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions