SAP/ui5-webcomponents-react

VariantManagament: Unable to switch to default view after creating new one

Closed this issue ยท 6 comments

Describe the bug

On some of our views we have analytical tables with VariantManagament. Whenever user enters such view for the first time he/she gets the default, hardcoded variant called Standard. When user introduces some change in the column config then Save as button becomes active, user saves the view as Standard2 (name doesn't matter here) with Set as default checkbox checked. After this action user gets to the Standard2 variant and it's not possible to change the variant back to Standard. Also, it looks like Standard is still selected.

In the scenario when user have more variants, only the previously selected one is blocked - other variants can be accessed and when user switches to one of them then Standard would get unblocked.

Isolated Example

No response

Reproduction steps

Prerequisite: only default variant present in variant manager

  1. Introduce a change
  2. Save as new variant
  3. Try to navigate back to previous variant (doesn't work)
  4. Introduce next change
  5. Create third variant
  6. Try to navigate to second variant (doesn't work)
  7. Try to navigate to first variant (works)
  8. Try to navigate to second variant (now works)

Expected Behaviour

All of the variants are selectable and working no matter if user just created a new variant.

Screenshots or Videos

image

UI5 Web Components for React Version

2.1.1

UI5 Web Components Version

2.2.0

Browser

Chrome

Operating System

MacOS Sequoia 15.1

Additional Context

Analytical tables used with the VariantManagament are very big, up to almost 300 columns and god-knows-how-many rows.

Relevant log output

No response

Organization

SAP Fioneer

Declaration

  • Iโ€™m not disclosing any internal or sensitive information.

Hi @superdyzio

I wasn't able to reproduce this issue. Please add an isolated example preferably by leveraging StackBlitz. You can either use the example I've created when trying to reproduce the issue, or our template.

@Lukas742 I used your example and was able to reproduce it and I'm a bit confused - I didn't change a thing in the stackblitz example code

Screen.Recording.2024-11-17.at.20.58.53.mov

@superdyzio there was a mistake in my example. I didn't update the isDefault property of the first VariantItem, which causes multiple default variants after saving (not supported).

Here's the updated example:
https://stackblitz.com/edit/ui5wcr-vm-saveas-lnktd4?file=src%2FApp.tsx
Could you check again if this works for you now?

Edit: Found another problem... I'll update this issue once this is fixed as well.

This PR will add a note explaining which props need to be unique for each VariantManagement and will also fix some more issues with internal boolean value assignments.

@Lukas742 I see, we'll make sure that we always have only one default variant, thanks for the investigation! we're waiting for your remaining fixes and looking forward to the release including our recent bugfixes ๐ŸŽ‰

The issue I found previously will also be resolved by the linked PR. In some cases the isDefault value was not reflected correctly in the manage or save view dialog.

Apart from that I've edited my example from above to include all necessities:

  • The isDefault prop is now updated accordingly.
  • Selection change is now handled by the React state as well (via the onSelect event)

https://stackblitz.com/edit/ui5wcr-vm-saveas-gewoqx?file=src%2FApp.tsx

๐ŸŽ‰ This issue has been resolved in version v2.5.0 ๐ŸŽ‰

The release is available on v2.5.0

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€