Skip to content
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

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Conversation

ivan-nejezchleb
Copy link
Contributor


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:

extended test - backstop
extended test - tiger-cypress - integrated
extended test - tiger-cypress - isolated
extended test - tiger-cypress - record

@@ -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';
Copy link
Contributor

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] : {}),
Copy link
Contributor

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] ?? {} : {}),

Copy link
Contributor Author

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;
Copy link
Contributor

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)

Copy link
Contributor Author

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";
Copy link
Contributor

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.

Copy link
Contributor Author

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}
Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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
@ivan-nejezchleb ivan-nejezchleb added this pull request to the merge queue Nov 27, 2024
Merged via the queue into master with commit 6c1f589 Nov 27, 2024
6 checks passed
@ivan-nejezchleb ivan-nejezchleb deleted the ine-lx-668-2 branch November 27, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants