-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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: maximum call stack size #4674
Conversation
|
WalkthroughThe pull request introduces several changes primarily to the Changes
Assessment against linked issues
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
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
CodeRabbit Configuration File (
|
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: 1
🧹 Outside diff range and nitpick comments (3)
packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue (1)
48-60
: LGTM! Consider adding type annotation and unit tests.The changes to the
tabsView
computed property align with the PR objective to fix the "Maximum call stack size exceeded" error. The removal ofdeepToRaw
and simplification of the mapping function should improve performance and reduce the risk of stack overflow.However, consider the following suggestions:
- Add a type annotation to the
tabsView
computed property to maintain type safety:const tabsView = computed((): { affixTab: boolean; closable: boolean; icon: string; key: string; name: string; title: string }[] => { // ... existing code ... });
- To ensure the changes don't introduce new bugs, it would be beneficial to add or update unit tests for this component.
Would you like assistance in generating unit tests for the
tabsView
computed property?packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue (1)
43-51
: LGTM! Consider adding type annotation for improved safety.The changes to the
tabsView
computed property look good. The removal ofdeepToRaw
simplifies the code and potentially improves performance. The addition of thename
property provides more flexibility in tab handling.These changes align well with the PR objective of fixing the "Maximum call stack size exceeded" error by simplifying object handling.
For improved type safety, consider adding a type annotation to the
map
function:- return props.tabs.map((tab) => { + return props.tabs.map((tab): TabConfig => {This ensures that the returned object strictly adheres to the
TabConfig
interface.packages/effects/layouts/src/basic/layout.vue (1)
115-115
: Approve the use ofcloneDeep
inwrapperMenus
function.The change from
deepToRaw
tocloneDeep
in thewrapperMenus
function is consistent with the import statement modification and should help prevent the stack overflow issue.Consider this minor optimization to avoid unnecessary deep cloning of primitive values:
- return { ...cloneDeep(item), name: $t(item.name) }; + const clonedItem = cloneDeep(item); + clonedItem.name = $t(item.name); + return clonedItem;This change ensures that we're not unnecessarily cloning the already translated
name
property.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
- packages/@core/base/shared/package.json (0 hunks)
- packages/@core/base/shared/src/utils/index.ts (0 hunks)
- packages/@core/base/shared/src/utils/reactivity.ts (0 hunks)
- packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue (1 hunks)
- packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue (2 hunks)
- packages/effects/layouts/src/basic/layout.vue (2 hunks)
💤 Files with no reviewable changes (3)
- packages/@core/base/shared/package.json
- packages/@core/base/shared/src/utils/index.ts
- packages/@core/base/shared/src/utils/reactivity.ts
🧰 Additional context used
🔇 Additional comments (3)
packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue (1)
Line range hint
1-138
: Summary: Changes address the reported issue and improve code quality.The modifications in this file effectively address the "Maximum call stack size exceeded" error by removing the
deepToRaw
function and simplifying the tab processing logic. The changes align well with the PR objectives and should resolve the reported issue.Key improvements:
- Removal of unnecessary
TabConfig
import and usage.- Simplification of the
tabsView
computed property.- Addition of the
name
property to tab objects.These changes should improve performance and reduce the risk of stack overflow errors. The code quality has been enhanced through simplification, although adding a type annotation to
tabsView
would further improve type safety.Overall, the changes look good and achieve the intended goals of the PR.
packages/effects/layouts/src/basic/layout.vue (2)
Line range hint
1-385
: Summary of changes and expected impact.The modifications in this file are focused on addressing the "Maximum call stack size exceeded" error mentioned in the PR objectives. The primary changes involve:
- Replacing
deepToRaw
withcloneDeep
in the import statement.- Updating the
wrapperMenus
function to usecloneDeep
instead ofdeepToRaw
.These changes should resolve the stack overflow issue while maintaining the original functionality of the component. The rest of the file remains unchanged, which minimizes the risk of introducing new bugs.
To ensure the changes have the intended effect:
- Verify that the "Maximum call stack size exceeded" error no longer occurs after building the project.
- Test the application's behavior when logging in and out, particularly focusing on the display of small tabs.
- Conduct thorough testing of menu-related functionality to ensure no regressions have been introduced.
Run the following script to check for any potential issues related to the changes:
✅ Verification successful
Verification Successful
All checks have passed:
- No remaining uses of
deepToRaw
in the codebase.cloneDeep
is correctly imported from@vben/utils
.- No circular dependencies detected that could cause stack overflow.
These changes effectively address the "Maximum call stack size exceeded" error without introducing new issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of changes on menu-related functionality # Test: Check for any remaining uses of deepToRaw in menu-related files rg --type vue --type ts --type js 'deepToRaw' packages/effects/layouts/src/ # Test: Verify that cloneDeep is properly imported in menu-related files rg --type vue --type ts --type js 'import.*cloneDeep.*from.*@vben/utils' packages/effects/layouts/src/ # Test: Look for any potential circular dependencies that might still cause stack overflow rg --type vue --type ts --type js 'import.*from.*@vben/utils.*\nimport.*from.*@vben/utils' packages/effects/layouts/src/Length of output: 551
Script:
#!/bin/bash # Description: Verify the impact of changes on menu-related functionality # Test: Check for any remaining uses of deepToRaw in menu-related files rg 'deepToRaw' packages/effects/layouts/src/ --glob '*.vue' --glob '*.ts' --glob '*.js' # Test: Verify that cloneDeep is properly imported in menu-related files rg 'import\s+.*cloneDeep.*from\s+["@]vben/utils["]' packages/effects/layouts/src/ --glob '*.vue' --glob '*.ts' --glob '*.js' # Test: Look for any potential circular dependencies that might still cause stack overflow rg 'import\s+.*from\s+["@]vben/utils["]' packages/effects/layouts/src/ --glob '*.vue' --glob '*.ts' --glob '*.js' --multilineLength of output: 342
14-14
: Approve the replacement ofdeepToRaw
withcloneDeep
.This change from
deepToRaw
tocloneDeep
is likely to resolve the "Maximum call stack size exceeded" error mentioned in the PR objectives. ThecloneDeep
function is generally more robust when dealing with complex or circular data structures, which could have been causing the stack overflow issue.To ensure this change doesn't introduce any new issues, please run the following verification script:
✅ Verification successful
Replacement of
deepToRaw
withcloneDeep
verified successfully. No remaining instances ofdeepToRaw
found.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining uses of deepToRaw in the codebase # Test: Search for any remaining uses of deepToRaw rg --type vue --type ts --type js 'deepToRaw' # Test: Verify that cloneDeep is imported from @vben/utils in other files rg --type vue --type ts --type js 'import.*cloneDeep.*from.*@vben/utils'Length of output: 176
Script:
#!/bin/bash # Description: Check for any remaining uses of deepToRaw in the codebase # Test: Search for any remaining uses of deepToRaw in .vue, .ts, and .js files rg 'deepToRaw' --glob='*.vue' --glob='*.ts' --glob='*.js' # Test: Verify that cloneDeep is imported from @vben/utils in .vue, .ts, and .js files rg 'import\s+.*cloneDeep.*from\s+["\']@vben/utils["\']' --glob='*.vue' --glob='*.ts' --glob='*.js'Length of output: 151
Script:
#!/bin/bash # Description: Check for any remaining uses of deepToRaw in the codebase # Test: Search for any remaining uses of deepToRaw in .vue, .ts, and .js files rg "deepToRaw" --glob "*.vue" --glob "*.ts" --glob "*.js" # Test: Verify that cloneDeep is imported from @vben/utils in .vue, .ts, and .js files rg "import\s+.*cloneDeep.*from\s+['\"]@vben/utils['\"]" --glob "*.vue" --glob "*.ts" --glob "*.js"Length of output: 383
* fix: maximum call stack size
Description
fixed #4672
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit
New Features
name
in the tab configuration.Bug Fixes
deepToRaw
utility, simplifying tab object handling.Refactor
cloneDeep
instead ofdeepToRaw
.tabsView
computed property across tab components.tabsView
computed property.