Skip to content

GET /api/v1/dashboard/{pk}/filter_state/{key} does not return "name" property #36053

Closed

Description

@rauno-plg

Bug description

There seems to be a bug with GET /api/v1/dashboard/{pk}/filter_state/{key} route in the API.

When i fire the API request for the first time i do not get "name" property in the response for applied filter state.

For some reason if i do a random change in current filters(for an example just add a random divider) the same filter state key shows me the name parameter in the API response.

Happens with master from 4th of november.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Activity

  1. added
    api:dashboard
    on Nov 10, 2025
  2. dosubot commented on Nov 10, 2025

    @dosubot

    Hi @rauno-plg! I'm Dosu and I’m helping the superset team.

    The backend for GET /api/v1/dashboard/{pk}/filter_state/{key} just returns whatever filter state was cached by the frontend—it doesn't add or remove properties like "name" itself. If the "name" property is missing on the first request but appears after you change a filter, it's likely because the frontend didn't include "name" in the initial filter state payload, but does after a filter update. This means the issue is probably with how the frontend constructs and sends the filter state, not the backend API logic. If you want "name" to always be present, check how your dashboard's filter state is initialized and ensure the frontend includes it in the payload from the start.

    For more details, see the backend implementation here.

    To reply, just mention @dosu.


    How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

  3. devjs2705 commented on Nov 10, 2025

    @devjs2705

    Hi @rauno-plg
    Happy to work on this issue, if you could assign me

    Thank you

  4. rauno-plg commented on Nov 12, 2025

    @rauno-plg
    Author

    Hello @dosu

    Having troubles of understanding how would i properly "warm" up the cache in this context. I would expect the "name" parameter to appear by default without any additional API calls whenever i select some filter value(and there is no problem with filters in general, they do appear, just without "name" parameter at first), since the filters have their labels in the dashboard and the name parameter is the filter label value. Please let me know if i misunderstand something here.

    @devjs2705 i think the project admins need to assign to you, but thanks for expressing openness to work on this.

  5. dosubot commented on Nov 12, 2025

    @dosubot

    In Superset, the filter state cache for dashboards is managed entirely by the frontend. The backend just returns whatever filter state the frontend last sent—it doesn't add properties like "name" itself. The reason you don't see the "name" property on the first API call is that the frontend doesn't include it in the initial filter state payload; it only appears after you interact with the filters, which triggers the frontend to update the payload and include "name" at that point.

    If you want "name" to always be present in the filter state from the start, the frontend code needs to explicitly add it when constructing the initial filter state before sending it to the backend. Right now, this doesn't happen by default during initialization—only after a filter change or update. There's no backend or automatic cache warm-up that will fix this; it has to be handled in the frontend logic that assembles and publishes the filter state (see the FilterBar component and related state management code for where this happens) source.

    So, to "warm up" the cache with the "name" property, you'd need to ensure the frontend includes "name" in the filter state payload right from the start—likely by modifying the logic that builds the initial filter state object before it's sent to the backend. If you need a code pointer or example for where to inject this, let me know!

    To reply, just mention @dosu.


    How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

  6. rauno-plg commented on Nov 12, 2025

    @rauno-plg
    Author

    @dosu Alright, i understand. So what you are saying is that it's not problem on API side, but rather on frontend side. I believe then we should change the front-end logic so the 'name' parameter would be included by default, since it seems bug on frontend side. If the update in filters triggers the 'name' parameter being present then initial filter state construction is flawed.

  7. dosubot commented on Nov 12, 2025

    @dosubot

    That's exactly right—the issue is in the frontend logic. The initial filter state payload sent to the backend doesn't include the 'name' property, which is why it's missing from the first API response. When you interact with the filters, the frontend updates the payload and includes 'name', so it appears after a change.

    To fix this, update the frontend code to copy each filter's config 'name' property into the initial filter state payload before it's sent to the backend. The best places to patch are the FilterBar component (index.tsx) and the logic that builds the initial dataMask (see getInitialDataMask and fillNativeFilters).

    For example, when constructing the initial filter state object for each filter, add something like:

    filterState: {
      ...baseDataMask.filterState,
      name: filter.name, // <-- add this line
    }

    Let me know if you want more detailed code pointers or help with the patch!

    To reply, just mention @dosu.


    How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

  8. rusackas commented on Nov 12, 2025

    @rusackas
    Member

    We're open to a PR if anyone wants to tackle this. Or a failing test case with example datasets/dashboards. Otherwise, it might get moved to a discussion if we can't reproduce a bug.

  9. added a commit that references this issue on Nov 25, 2025
    56a52fd
  10. rusackas commented on Jun 17, 2026

    @rusackas
    Member

    Looks like #36262 is open and mergeable for this — could use a review rather than more discussion here. I left a comment there myself, looks like it needs a little touchup. Opinions welcome.

  11. rusackas commented on Sep 9, 2026

    @rusackas
    Member

    Closed out #36262 since the id-extraction there didn't match how filter_state is actually shaped for a real dashboard (it's a map keyed by filter id, not a flat object). The right fix pulls the name from the dashboard's native_filter_configuration instead of the cached blob, open to a PR that takes that route. I might just take a shot at it, actually... if you see a PR here, please test/review :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:dashboard

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions