Skip to content

[EuiDataGrid] Reset internal state of row height / density popover when props change  #5593

Closed as not planned

Description

@kertal

We recently implemented custom row height selection in Discover 🥳 (PR #122087) . There's an issue we've encountered. When users select a new row height, this is propagated to the URL, and EuiDataGrid retrieves this new setting. So it's the new default. But the way it currently works is that once users change the row height, the "Reset to default" link is displayed, and clicking on it makes it disappear.

reset-to-default.mp4

What's more, if the user changes the setting in URL, it's ignored (given the value was changed in the popover before), so the external change doesn't change the grid's internal one.

Activity

  1. added
    ⚠️ needs validation
    on Feb 3, 2022
  2. cee-chen commented on Feb 3, 2022

    @cee-chen
    Contributor

    But the way it currently works is that once users change the row height, the "Reset to default" link is displayed, and clicking on it makes it disappear.

    Is this just an undesired behavior on your end? Our localStorage example does the same thing, and I guess I didn't really see that as a problem - the reset button allows users to set the grid back to the way it was when the page loaded, which seems like a valid use of the button. The user can just ignore it if they're fine with the changes, and the next time they visit the page their settings will be saved.

    CCing @cchaos as she originally requested the button - should we consider passing in an option that allows applications to disable the Reset button on the display selector?

    What's more, if the user changes the setting in URL, it's ignored

    This confuses me a bit - if a user changes the setting in the URL, they're essentially reloading the page and causing a full data grid remount, correct? At which point there should no longer be internal user settings, and the settings loaded in from the consuming application should be the default. How are those changes being ignored then?

    (Linking these two recent issues for historical context as they're somewhat related and have a caveat section on how user changes should override application changes - #5526 and #5524)

  3. cchaos commented on Feb 3, 2022

    @cchaos
    Contributor

    I also am confused by the settings in the url implementation in Discover. Wouldn't this make the browser history way too complex in terms of the user's understanding of how the back button works? It honestly doesn't seem like the right location to be storing these settings. They're not creating new pages but just altering the display.

  4. kertal commented on Feb 4, 2022

    @kertal
    MemberAuthor

    I'll follow up here, after my vacation ... just wanted to express the joy, that with "Auto fit" we now can reveal unknown details of our content

    Auto-fit-cat.mp4
  5. cee-chen commented on Feb 4, 2022

    @cee-chen
    Contributor

    I won't lie, the timing on that auto fit reveal absolutely slayed me

  6. cchaos commented on Feb 7, 2022

    @cchaos
    Contributor

    We absolutely need this as a demo! 😹

  7. kertal commented on Mar 4, 2022

    @kertal
    MemberAuthor

    Will ask the cat for permission (which reminds me, I think I didn't ask, but bribed with some good bites) 😸

  8. kertal commented on Mar 4, 2022

    @kertal
    MemberAuthor

    Anyway, let me show what I mean.
    Discover_-_Elastic
    Changing to 7
    Discover_-_Elastic

    So the internal state of the popover should the changed when external props overwrite it's settings

  9. kertal commented on Mar 4, 2022

    @kertal
    MemberAuthor

    This confuses me a bit - if a user changes the setting in the URL, they're essentially reloading the page and causing a full data grid remount, correct?

    No there's a listener for URL changes modifying the state in Discover

  10. kertal commented on Mar 4, 2022

    @kertal
    MemberAuthor

    I also am confused by the settings in the url implementation in Discover. Wouldn't this make the browser history way too complex in terms of the user's understanding of how the back button works? It honestly doesn't seem like the right location to be storing these settings. They're not creating new pages but just altering the display.

    This is how it's historically done in Discover, most of the state is in URL. I can see your point about the browser history ... also reproduced it ... when switching the Lines per row slider, plenty of history entries are created ... think no history should be added in this case, the current history entry should be replaced

  11. kertal commented on Mar 4, 2022

    @kertal
    MemberAuthor

    BTW, not only allows data grid to reveal unknown details of your content, it also helps to hide unwanted details, so you can focus of things that really matter:

    karli-grumpy.mp4
  12. cee-chen commented on Mar 14, 2022

    @cee-chen
    Contributor

    Hey Matthias! Sorry, I didn't mean to let this drop to the floor or get distracted by your hilarious cat. I see now that you're storing display selector state in a URL param which wouldn't trigger a page rerender. I'm still a little confused as to why the Reset to default button is problematic in terms of UI. I still think it's valid for a user to reset to whatever settings they had on page load. If you simply don't want users to be able to reset, would a config option to disable the reset button suffice?

  13. kertal commented on Mar 15, 2022

    @kertal
    MemberAuthor

    hi, sorry too, for using my distracting cat 😄 . So it's not problematic, it's just redundant. Users can't reset to the state on page load, because every change is propagated to external state and becomes the default state. But the popover doesn't know and therefore offers to reset to default state ... I'd suggest to have a quick zoom when it's convenient for you, if you want

  14. chandlerprall commented on Mar 15, 2022

    @chandlerprall
    Contributor

    I think we can discuss the discover setup with the first Data grid styling and control example as a proxy.

    datagrid-gridstyle-reset.mov

    The difference between the example & discover's implementation is discover uses gridStyle.onChange to merge the user's changes into their grid style object. To emulate this thought with the example, select 'normal' density through the grid control and then update the gridStyle options with medium padding & font size; now open the grid's control again, the ask here is that the Reset button would be gone because resetting would not effect any difference.

    My 2 cents: the reset button's existence is based on if the user interacts with the grid control to change from the default, we may be able to make this respect changes to gridStyles as well.

    My 2 cents with a Front End Engineer hat: the application should add a layer of state to hold the initial page load data (which would update if the user refreshes the page or otherwise loads from the stateful URL) separate from updated-but-not-committed state

    My 2 cents with an Information Architecture or Product hat: the core issue is treating both ephemeral & permanent state the same. Even if we implement Front End Engineer's above suggestion, the user journey doesn't feel right because upon re-loading the page with the updated styles in the URL that becomes the new default, instead of continuing to allow the app to set defaults + user overrides, providing a predictive flow allowing users to always reset any changes.

    My 2 cents with a Kibana Engineer hat: I sure do wish we had a mechanism to save per-user settings 😁

  15. 14 remaining items

  16. added
    stale-issue-closed
    on Feb 8, 2023
  17. kertal commented on Feb 8, 2023

    @kertal
    MemberAuthor

    I tested it, and I still thing this is worth an improvement

  18. reopened this on Feb 8, 2023
  19. JasonStoltz commented on Feb 8, 2023

    @JasonStoltz
    Contributor

    Hey @kertal. We've been grooming our enormous backlog over the past couple of months, trying to sort it into a prioritized list. We've identified this as a "Low" priority, "Medium" effort task, which means, this is very unlikely to be prioritized by our team to address. We simply don't have the time or resources.

    For reference: https://github.com/orgs/elastic/projects/1079

    If you feel this warrants more than a "Low" priority, please let us know. We're also happy to accept pull requests!

  20. kertal commented on Feb 8, 2023

    @kertal
    MemberAuthor

    thx @JasonStoltz I do agree it's a low priority task, sadly it's unlikely that there will be a pull request, for the same reason: time / resources

  21. removed
    stale-issue-closed
    stale-issue
    on Feb 8, 2023
  22. github-actions commented on Oct 22, 2023

    @github-actions

    👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.

  23. added
    stale-issue
    on Oct 22, 2023
  24. cee-chen commented on Oct 23, 2023

    @cee-chen
    Contributor

    @kertal can we close this issue out now that your team has added a allowResetButton configuration that allows hiding the reset button completely?

  25. removed
    stale-issue
    on Oct 23, 2023
  26. kertal commented on Oct 23, 2023

    @kertal
    MemberAuthor

    yes we can! 👍

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions