-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix: nested layout min width limit on Lg screen #5614
Conversation
JIRA: LX-668 risk: low
0d20bca
to
5af3649
Compare
@@ -260,13 +266,15 @@ import { IWidgetAlert } from '@gooddata/sdk-model'; | |||
import { IWidgetDefinition } from '@gooddata/sdk-model'; | |||
import { IWorkspacePermissions } from '@gooddata/sdk-model'; | |||
import { IWorkspaceUser } from '@gooddata/sdk-model'; | |||
import { LayoutState as LayoutState_2 } from './layoutState.js'; |
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.
I'm not sure state and all the actions from line 5970 should be exposed in contract.
layoutItemSize?: IDashboardLayoutSizeByScreenSize, | ||
): IDashboardLayoutSize => { | ||
return { | ||
...(layoutItemSize ? layoutItemSize[screen] : {}), |
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.
there could still be a null pointer exc when layoutItemSize
does not have size for provided screen. This should handle it:
...(layoutItemSize ? layoutItemSize[screen] ?? {} : {}),
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.
fixed
layoutItemSize?: IDashboardLayoutSizeByScreenSize, | ||
) => { | ||
// Determine if element has size set in metadata object for the current screen size | ||
const providedSizeForScreen = layoutItemSize ? layoutItemSize[screen] : undefined; |
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.
const providedSizeForScreen = layoutItemSize.?[screen];
is shorter (this is probably older code)
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.
fixed
@@ -181,9 +181,12 @@ export { selectLegacyDashboards } from "./legacyDashboards/legacyDashboardsSelec | |||
|
|||
export type { UndoEnhancedState, UndoEntry } from "./_infra/undoEnhancer.js"; | |||
export type { LayoutState, LayoutStash } from "./layout/layoutState.js"; | |||
|
|||
export { layoutActions } from "./layout/index.js"; |
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.
Should this be exposed? I don't see other store actions being exposed directly.
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.
replaced by command+event combo
<DashboardScreenSizeContext.Provider value={screenSize}> | ||
{children} | ||
{!appStateScreenSize ? null : children} |
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.
Please flip the condition to remove unnecessary negation.
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.
fixed
@@ -25,6 +37,20 @@ const getScreenSize = (ref: React.RefObject<HTMLDivElement>): ScreenSize => { | |||
return "xs"; | |||
}; | |||
|
|||
function setNewSize( | |||
screenSize: string | undefined, |
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.
maybe rename this to previousScreenSize
?
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.
fixed
setScreenSize: React.Dispatch<React.SetStateAction<ScreenSize | undefined>>, | ||
dispatch: React.Dispatch<AnyAction>, | ||
) { | ||
const newSize = getScreenSize(); |
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.
possibly change this to const currentScreenSize = detectCurrentScreenSize();
or getCurrentScreenSize
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.
fixed
9562648
to
b4bee1d
Compare
Nested layout width limit was not working on Lg screen. Screen size was needed also in sagas so context was not enough. Screen provider syncs screen size to app state. Screen size provider rewritten to measure whole window not its container. It is not optimal for embedding use case, but needed for KD compatibility. JIRA: LX-668 risk: low
b4bee1d
to
3fb03e4
Compare
Important
Please, don't forget to run
rush change
for the commits that introduce new features 🙏Refer to documentation to see how to run checks and tests in the pull request. This is the list of the most used commands: