-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat: made changes to expose the App's height and width as part of the appsmith.ui state object #41339
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
Merged
+74
−2
Merged
feat: made changes to expose the App's height and width as part of the appsmith.ui state object #41339
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
71e7be8
Made changes to expose the apps height and width in the appsmith.ui s…
tomjose92 2208b17
fixed issues that came through yarn check-type.
tomjose92 d87c395
Added debounce for the handleResize in the AppIDE and AppPage ccompon…
tomjose92 1099d28
Removed changes related to handle resize event listener. Now just cal…
tomjose92 c360db0
Added feature flag for enabling window dimensions as part of state. O…
tomjose92 1b50c59
Removed the need for windowSaga.
tomjose92 f12b699
Merge branch 'release' into feat/appsmith-ui-dimensions
tomjose92 134a977
Set initial value of release_window_dimensions_enabled flag as false
tomjose92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; | ||
|
|
||
| export const updateWindowDimensions = (height: number, width: number) => ({ | ||
| type: ReduxActionTypes.UPDATE_WINDOW_DIMENSIONS, | ||
| payload: { height, width }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { createImmerReducer } from "utils/ReducerUtils"; | ||
| import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; | ||
| import type { ReduxAction } from "actions/ReduxActionTypes"; | ||
|
|
||
| export interface WindowDimensionsState { | ||
| height: number; | ||
| width: number; | ||
| } | ||
|
|
||
| const initialState: WindowDimensionsState = { | ||
| height: typeof window !== "undefined" ? window.innerHeight : 0, | ||
| width: typeof window !== "undefined" ? window.innerWidth : 0, | ||
| }; | ||
|
|
||
| const windowReducer = createImmerReducer(initialState, { | ||
| [ReduxActionTypes.UPDATE_WINDOW_DIMENSIONS]: ( | ||
| state: WindowDimensionsState, | ||
| action: ReduxAction<{ height: number; width: number }>, | ||
| ) => { | ||
| state.height = action.payload.height; | ||
| state.width = action.payload.width; | ||
| }, | ||
| }); | ||
|
|
||
| export default windowReducer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { ReduxActionTypes } from "ee/constants/ReduxActionConstants"; | ||
| import { takeLatest, select, call } from "redux-saga/effects"; | ||
| import { evaluateTreeSaga } from "./EvaluationsSaga"; | ||
| import { getUnevaluatedDataTree } from "selectors/dataTreeSelectors"; | ||
|
|
||
| export function* handleWindowDimensionsUpdate() { | ||
| const unEvalAndConfigTree: ReturnType<typeof getUnevaluatedDataTree> = | ||
| yield select(getUnevaluatedDataTree); | ||
|
|
||
| yield call(evaluateTreeSaga, unEvalAndConfigTree); | ||
| } | ||
|
|
||
| export default function* windowSaga() { | ||
| yield takeLatest( | ||
| ReduxActionTypes.UPDATE_WINDOW_DIMENSIONS, | ||
| handleWindowDimensionsUpdate, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { DefaultRootState } from "react-redux"; | ||
| import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; | ||
| import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; | ||
|
|
||
| export const getWindowDimensions = (state: DefaultRootState) => { | ||
| const isWindowDimensionsEnabled = selectFeatureFlagCheck( | ||
| state, | ||
| FEATURE_FLAG.release_window_dimensions_enabled, | ||
| ); | ||
|
|
||
| return isWindowDimensionsEnabled ? state.ui.windowDimensions : undefined; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
Verify the structure of
appsmith.uito match the intended API.The assignment
ui: windowDimensionsdirectly exposes the window dimensions object (withheightandwidthproperties) asappsmith.ui. Ensure this matches the desired public API structure and doesn't conflict with any existinguiproperty.🏁 Script executed:
Length of output: 27
Length of output: 34
🏁 Script executed:
Length of output: 691
🏁 Script executed:
Length of output: 34
Length of output: 2717
🏁 Script executed:
Length of output: 31
🏁 Script executed:
Length of output: 613
🏁 Script executed:
Length of output: 3987
Length of output: 451
🏁 Script executed:
Length of output: 1319
Length of output: 656
🏁 Script executed:
Length of output: 906
Add
uiproperty to the AppsmithEntity interface definition.The assignment of
ui: windowDimensionsat line 188 is being bypassed by theas AppsmithEntitycast at line 193, but theuiproperty is not declared in the interface. Production code in ExternalWidget and CustomWidget actively consumesappsmith.uiwith a{width, height}structure, confirming this is intentional.Update
app/client/src/ce/entities/DataTree/types.tsto declare the property:🤖 Prompt for AI Agents