-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: remove redundant eval trigger #36764
Conversation
This reverts commit 69cd49d.
WalkthroughThe changes in this pull request primarily involve modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
app/client/src/pages/AppViewer/index.tsx (1)
165-170
: Excellent work on refactoring the page resource fetching, students!Your modification to use
fetchPublishedPageResources
instead ofsetupPublishedPage
is a step in the right direction. This change streamlines our code and makes the intent clearer. Well done!However, to make your code even more readable, consider destructuring the
pageId
from thepages.find()
result. Here's a small homework assignment for you:Try refactoring the code like this:
const page = pages.find((page) => page.basePageId === basePageId); if (page?.pageId) { dispatch( fetchPublishedPageResources({ basePageId, pageId: page.pageId, }), ); }This approach avoids nested property access and makes the code a bit easier to follow. Keep up the good work!
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (7)
- app/client/src/actions/pageActions.tsx (2 hunks)
- app/client/src/ce/constants/ReduxActionConstants.tsx (1 hunks)
- app/client/src/ce/sagas/PageSagas.tsx (5 hunks)
- app/client/src/ce/sagas/tests/PageSaga.test.ts (0 hunks)
- app/client/src/entities/Engine/AppViewerEngine.ts (1 hunks)
- app/client/src/pages/AppViewer/index.tsx (2 hunks)
- app/client/src/reducers/uiReducers/appViewReducer.tsx (2 hunks)
💤 Files with no reviewable changes (1)
- app/client/src/ce/sagas/tests/PageSaga.test.ts
🧰 Additional context used
🔇 Additional comments (13)
app/client/src/reducers/uiReducers/appViewReducer.tsx (3)
29-33
: Excellent addition, class! Let's discuss the newFETCH_PUBLISHED_PAGE_RESOURCES_INIT
action handler.This new handler is doing a splendid job of setting our
isFetchingPage
state totrue
when we begin fetching published page resources. It's like raising your hand to answer a question - it shows we're actively working on something!Remember, class, this is important because:
- It helps us track when a fetch operation is in progress.
- We can use this state to show loading indicators in our UI.
- It follows the same pattern as our existing
FETCH_PUBLISHED_PAGE_INIT
handler, maintaining consistency in our code.Keep up the good work!
52-59
: Well done on adding theFETCH_PUBLISHED_PAGE_RESOURCES_SUCCESS
action handler!Class, let's examine this new addition to our reducer. This handler is responsible for setting our
isFetchingPage
state back tofalse
when we've successfully fetched our published page resources. It's like putting your hand down after you've finished answering a question - it shows we're done with our task!Here's why this is important:
- It signals the completion of our fetch operation.
- We can use this to remove loading indicators from our UI.
- It maintains symmetry with our
INIT
action, providing a clear start and end to our fetching process.Remember, good code tells a story, and this handler helps complete the narrative of our resource fetching process. Excellent work!
Line range hint
29-59
: Class, let's summarize what we've learned from these changes!These additions to our
appViewReducer
are like adding new chapters to our Redux storybook. They enhance our ability to manage the state of fetching published page resources, which is crucial for keeping our application's narrative coherent and our users informed.Here's what we've accomplished:
- We've added symmetrical handlers for initializing and completing the fetch process.
- We're maintaining consistency with our existing patterns, which is key for code readability.
- We've improved our ability to manage loading states, which will enhance our user experience.
Remember, class, good state management is like good storytelling - it keeps everyone on the same page and prevents confusion. These changes do just that!
Keep up the excellent work, and don't forget to apply these principles in your future coding adventures!
app/client/src/entities/Engine/AppViewerEngine.ts (1)
108-108
: Class, let's examine this change carefully.Now, students, we've noticed an interesting modification in our code. The
setupPublishedPage
function call has had one of its parameters removed. This is like changing the ingredients in a recipe - it might affect the final dish!Let's break it down:
- We've removed the second
true
parameter from the function call.- This change could potentially alter how our page setup process works.
Here's your homework assignment:
- Verify that this change aligns with the updated
setupPublishedPage
function definition. We want to make sure our function is receiving all the ingredients it needs!- If this change is correct, please update any relevant documentation. Remember, good documentation is like a clear lesson plan - it helps everyone understand what's happening.
Can anyone tell me why it's important to keep our function calls and definitions in sync?
To help us with our verification, let's use this little helper:
Remember, class, always double-check your work!
app/client/src/pages/AppViewer/index.tsx (1)
31-31
: Well done on simplifying the import statement, class!I'm pleased to see you've consolidated the imports related to fetching published page resources. This change not only makes our code more concise but also indicates a thoughtful refactoring of our action creators. Remember, clean imports lead to cleaner code!
app/client/src/actions/pageActions.tsx (3)
300-307
: Now, let's turn our attention to thefetchPublishedPageResources
function.Students, observe how the function signature has evolved. We're now using object destructuring to accept
basePageId
andpageId
as parameters. This is a more elegant approach that aligns with our updated interface.Can anyone tell me the benefits of this new structure? It provides better clarity and makes the function more flexible for future additions. Also, notice how the payload now includes
basePageId
. This ensures consistency with our interface changes.Remember, when we make changes like this, it's crucial to update all the places where this function is called. Let's verify that:
#!/bin/bash # Search for calls to fetchPublishedPageResources rg "fetchPublishedPageResources\(" --type typescript
Line range hint
693-703
: Let's examine the changes to oursetupPublishedPage
function, class.Notice how we've removed the
firstLoad
parameter. Can anyone tell me what implications this might have? It suggests we're changing our approach to handling the initial page load.Also, observe that
bustCache
is now a required parameter. This is an important change in our cache management strategy. It forces developers to be explicit about whether they want to bust the cache or not.These changes could have a significant impact on our page setup process. We need to ensure that all calls to this function are updated accordingly.
Let's do a quick check to see where we might need to update our code:
#!/bin/bash # Search for calls to setupPublishedPage rg "setupPublishedPage\(" --type typescript
76-77
: Class, let's examine the addition ofbasePageId
to our interface.The addition of
basePageId: string
to theFetchPublishedPageResourcesPayload
interface is an interesting development. Can anyone tell me how this might affect our page resource fetching process? It seems we're now distinguishing between a base page and the current page. This could have implications for how we manage page inheritance or versioning. Let's discuss the potential use cases for this new property.To ensure we understand the full impact of this change, let's investigate its usage:
app/client/src/ce/constants/ReduxActionConstants.tsx (3)
984-985
: Well done, class! These new constants are a great addition to our Redux action types.I'm pleased to see you've added
FETCH_PUBLISHED_PAGE_RESOURCES_INIT
andFETCH_PUBLISHED_PAGE_RESOURCES_SUCCESS
to ourAppViewActionTypes
. These new action types will help us manage the state of fetching published page resources more effectively.Remember, class, when we add new action types, it's important to consider their impact on the rest of our application. These new constants suggest we're improving how we handle published pages, which could lead to better performance or new features for our users.
Don't forget to update any relevant reducers and sagas to handle these new action types!
986-986
: Excellent work on adding the error type, students!I see you've included
FETCH_PUBLISHED_PAGE_RESOURCES_ERROR
in ourAppViewActionErrorTypes
. This is very good! Always remember, proper error handling is crucial in our Redux applications.Now, let's review our error handling best practices:
- Use this error type in your reducers to update the state when an error occurs.
- In your sagas or thunks, make sure to dispatch this error action when the fetch fails.
- Consider creating a user-friendly error message that can be displayed in the UI.
Keep up the good work, and don't forget to test your error scenarios thoroughly!
984-986
: Class, let's summarize what we've learned from these changes!These additions to our Redux action constants are focused and well-integrated:
- We've added
FETCH_PUBLISHED_PAGE_RESOURCES_INIT
andFETCH_PUBLISHED_PAGE_RESOURCES_SUCCESS
toAppViewActionTypes
.- We've also included
FETCH_PUBLISHED_PAGE_RESOURCES_ERROR
inAppViewActionErrorTypes
.These changes suggest we're enhancing our handling of published page resources. This could lead to improved performance or new features in our application's view mode.
Remember, when we make changes like these, we need to consider the broader impact:
- Update relevant reducers and sagas
- Implement proper error handling
- Test thoroughly, including success and error scenarios
Great job on maintaining consistency with our existing code structure. Keep up the excellent work!
app/client/src/ce/sagas/PageSagas.tsx (2)
1439-1445
:⚠️ Potential issueConfirm 'fetchPublishedPageAction' Accepts 'pageWithMigratedDsl' Parameter
Dear students, in lines 1439 to 1445, we are passing
pageWithMigratedDsl
as the third argument tofetchPublishedPageAction
. It's important to verify thatfetchPublishedPageAction
is designed to accept this parameter. If it doesn't, this might cause issues during action dispatching.Let's run a script to verify the action's parameters:
416-420
:⚠️ Potential issueEnsure 'response.pageWithMigratedDsl' is of Type 'FetchPageResponse'
Dear students, in lines 416 to 420, we are passing
response.pageWithMigratedDsl
to the functionpostFetchedPublishedPage
. Please verify thatresponse.pageWithMigratedDsl
is indeed of typeFetchPageResponse
, as expected bypostFetchedPublishedPage
. If it isn't, this could lead to type errors or unexpected behavior during execution.Let's run a script to confirm the type of
response.pageWithMigratedDsl
:✅ Verification successful
Let's run a corrected script to verify the type of
response.pageWithMigratedDsl
:
Alright, let's adjust our approach to successfully verify the type of
response.pageWithMigratedDsl
. We'll focus our search on TypeScript files by specifying their extensions directly.
Great job! The type of
response.pageWithMigratedDsl
is correctly defined asFetchPageResponse
, aligning with the expectations of thepostFetchedPublishedPage
function. Everything looks good here!🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the type of 'response.pageWithMigratedDsl' when passed to 'postFetchedPublishedPage' # Search for the definition of 'postFetchedPublishedPage' to confirm expected parameter types rg --type typescript 'export function\* postFetchedPublishedPage\(' -A 5 # Search where 'response.pageWithMigratedDsl' is defined to check its type rg --type typescript 'const response =.*' -A 5 # Find all instances where 'postFetchedPublishedPage' is called rg 'postFetchedPublishedPage\(' -A 3Length of output: 1051
Script:
#!/bin/bash # Description: Corrected script to verify the type of 'response.pageWithMigratedDsl' when passed to 'postFetchedPublishedPage' # Search for the definition of 'postFetchedPublishedPage' to confirm expected parameter types rg --type typescript 'export function\* postFetchedPublishedPage\(' -A 5 # Search where 'response' is defined to check the type of 'pageWithMigratedDsl' rg --type typescript 'const response =.*' -A 5 # Find all instances where 'postFetchedPublishedPage' is called rg 'postFetchedPublishedPage\(' -A 3Length of output: 480
Script:
#!/bin/bash # Description: Updated script to verify the type of 'response.pageWithMigratedDsl' when passed to 'postFetchedPublishedPage' # Search for the definition of 'postFetchedPublishedPage' to confirm expected parameter types in .ts and .tsx files rg 'export function\* postFetchedPublishedPage\(' --glob '*.ts' --glob '*.tsx' -A 5 # Search where 'response.pageWithMigratedDsl' is defined to check its type in .ts and .tsx files rg 'const response =.*' --glob '*.ts' --glob '*.tsx' -A 5 # Find all instances where 'postFetchedPublishedPage' is called in .ts and .tsx files rg 'postFetchedPublishedPage\(' --glob '*.ts' --glob '*.tsx' -A 3Length of output: 56748
Fixes #36237
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11267830066
Commit: 026ef4e
Cypress dashboard.
Tags:
@tag.All
Spec:
Thu, 10 Oct 2024 09:40:31 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Refactor
Tests