-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes issue with set anchor method #3761
base: main
Are you sure you want to change the base?
Conversation
I checked the issue and it seems like this originated from this comment which helped reproduce the issue. From the commit log that followed thereafter that comment it seems like it was decided that we just do not support setAnchor functionality for modals (and possibly other special microfrontends like splitview, drawer etc) at the moment as further investigation on how to do it is needed. We have introduced the isSpecialMF predicate for this here. In such a case if you follow the reproduce steps, the setAnchor function call is simply not reached because we disabled it. So I think the changes on this PR do not address that currently, and will need to change the issue to be a feature request than a bug. Discuss it in daily |
…om/SAP/luigi into 3399-set-anchor-for-wc-mf-in-modal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested some edge cases and found some potential scenario where this could break
for (let i = mfModalList.length; i--; ) { | ||
closeModal(i); | ||
|
||
if (!mfModalList.some((item) => item.modalWC && item.mfModal?.displayed)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is a bit hard to read directly. If I can read it correctly this means that:
"if in the list of modals there is at least an item that is WC-based and is currently at the top of the stack=displayed"
don't do anything
else
close all modals
Maybe the developer had another scenario where they have WC Based wc and displayed and want to close the modals also, not 'do nothing'.
I feel like in this way, can always find a failing scenario. For example, now, this fails to close all modals:
Luigi.navigation().openAsModal('/test/modalwc', { size:'l', keepPrevious: true});
Luigi.navigation().openAsModal('/test/modalwc2', { size:'m', keepPrevious: true});
Luigi.navigation().openAsModal('/test/overview', { size:'s', keepPrevious: true});
// navigate away
Luigi.navigation().navigate('/test/overview');
Question is though, instead of solving scenario after scenario, maybe rethink, what do we want to do when setAnchor is called inside a modal WC.
Maybe closing all modals and leaving the anchor at the main navigation could also be valid. I am not sure, I'll ask in daily again, since its not a common request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After my latest fix the scenario above will not fail, as all modals are closed after navigating away (separate process). The condition you're mentioning happens after route is updated, so it won't break anything as all modals are closed already
…om/SAP/luigi into 3399-set-anchor-for-wc-mf-in-modal
Description
Changes proposed in this pull request:
Related issue(s)
Resolves #3399