-
Notifications
You must be signed in to change notification settings - Fork 458
refactor: extract material-related code to useMaterial from useResource #591
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
refactor: extract material-related code to useMaterial from useResource #591
Conversation
WalkthroughThe recent update primarily focuses on replacing the Changes
Sequence DiagramsequenceDiagram
participant Component as Preview Component
participant ResourceModule as @opentiny/tiny-engine-meta-register
Component->>ResourceModule: useMaterial()
alt Material Found
ResourceModule-->>Component: Return Material
Note right of Component: Material retrieved successfully
else Material Not Found
ResourceModule-->>Component: Return Error
Note right of Component: Handle error or alternative scenario
end
Poem
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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: 4
Outside diff range and nitpick comments (7)
packages/settings/props/src/composable/useProperties.js (1)
Line range hint
219-222: Suggestion: Use optional chaining for safer property access.Consider using optional chaining to simplify property access and enhance code safety. This will help avoid potential runtime errors when properties might be undefined.
- const { props } = useProperties().getSchema() + const props = useProperties().getSchema()?.props || {}packages/plugins/materials/src/composable/useMaterial.js (1)
Line range hint
323-323: Optimize accumulator usage in reduce function.Using spread syntax in a reducer function can lead to performance issues due to repeated copying of objects. Consider using Object.assign or other methods to mutate the accumulator directly.
- componentState.componentsMap = appData.componentsMap?.reduce((componentsMap, component) => { - if (component.dependencies) { - getBlockDeps(component.dependencies) - } - return { ...componentsMap, [component.componentName]: component } - }, {}) + componentState.componentsMap = appData.componentsMap?.reduce((componentsMap, component) => { + if (component.dependencies) getBlockDeps(component.dependencies); + componentsMap[component.componentName] = component; + return componentsMap; + }, {});Tools
Biome
[error] 49-50: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 132-155: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 237-238: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
packages/plugins/materials/src/composable/useResource.js (4)
Line range hint
61-62: Refactor assignment within expression.Similar to the previous file, assignments within expressions can lead to confusion and errors. It's better to separate the logic for clarity and maintainability.
- const schema = { - componentName: component, - props: {}, - ...getSnippet(component) - } + const snippet = getSnippet(component); + const schema = { + componentName: component, + props: {}, + ...snippet + }
Line range hint
144-167: Remove redundant else clause.The
elseclause is unnecessary here because theifcondition ends with a return statement, making theelseredundant and less readable.- if (notFetchResouce) { - return block - } else { - if (!blockResource.get(label)) { + if (!notFetchResouce && !blockResource.get(label)) {
Line range hint
251-252: Remove unnecessary else clause.The
elseclause is redundant after a return statement in the preceding if block. This can simplify the control flow and improve readability.- if (response.status === 'fulfilled' && response.value.materials) { - addMaterials(response.value.materials) - } + if (response.status === 'fulfilled' && response.value.materials) addMaterials(response.value.materials);
Line range hint
437-439: Refactor assignment within expression.Using assignments within expressions can lead to confusion and errors. It's better to separate the logic for clarity and maintainability.
- const schema = { - componentName: component, - props: {}, - ...getSnippet(component) - } + const snippet = getSnippet(component); + const schema = { + componentName: component, + props: {}, + ...snippet + }packages/canvas/container/src/container.js (1)
Line range hint
239-247: Remove Unnecessary Else ClauseThe static analysis tool has flagged an unnecessary else clause. Removing it can simplify the control flow and improve code readability.
- else { - type = POSITION.BOTTOM - }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (28)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue (2 hunks)
- packages/canvas/container/src/CanvasContainer.vue (2 hunks)
- packages/canvas/container/src/components/CanvasAction.vue (2 hunks)
- packages/canvas/container/src/components/shortCutPopover.vue (2 hunks)
- packages/canvas/container/src/container.js (2 hunks)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vue (2 hunks)
- packages/configurator/src/slot-configurator/SlotConfigurator.vue (2 hunks)
- packages/controller/js/preview.js (2 hunks)
- packages/controller/src/index.js (1 hunks)
- packages/design-core/index.js (1 hunks)
- packages/entry/src/hooks.js (3 hunks)
- packages/plugins/materials/index.js (1 hunks)
- packages/plugins/materials/src/block/BlockGroupPanel.vue (2 hunks)
- packages/plugins/materials/src/block/BlockList.vue (2 hunks)
- packages/plugins/materials/src/block/Main.vue (3 hunks)
- packages/plugins/materials/src/component/Main.vue (2 hunks)
- packages/plugins/materials/src/composable/Untitled-1.ts (1 hunks)
- packages/plugins/materials/src/composable/index.js (2 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (6 hunks)
- packages/plugins/page/src/Main.vue (3 hunks)
- packages/plugins/tree/src/Main.vue (2 hunks)
- packages/settings/events/src/components/BindEvents.vue (2 hunks)
- packages/settings/props/src/components/inputs/BindFunction.vue (2 hunks)
- packages/settings/props/src/components/inputs/DraggableOptions.vue (3 hunks)
- packages/settings/props/src/composable/useProperties.js (2 hunks)
- packages/toolbars/refresh/src/Main.vue (2 hunks)
Files skipped from review due to trivial changes (1)
- packages/controller/src/index.js
Additional context used
Biome
packages/controller/js/preview.js
[error] 31-31: Avoid the use of spread (
...) syntax on accumulators. (lint/performance/noAccumulatingSpread)Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.packages/plugins/materials/src/composable/Untitled-1.ts
[error] 60-60: This default parameter should follow the last required parameter or should be a required parameter. (lint/style/useDefaultParameterLast)
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.packages/settings/props/src/composable/useProperties.js
[error] 219-222: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
packages/plugins/materials/src/composable/useMaterial.js
[error] 49-50: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 132-155: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 237-238: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 323-323: Avoid the use of spread (
...) syntax on accumulators. (lint/performance/noAccumulatingSpread)Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.packages/plugins/materials/src/composable/useResource.js
[error] 61-62: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 144-167: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 251-252: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 437-439: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.packages/canvas/container/src/container.js
[error] 239-247: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
Additional comments not posted (37)
packages/plugins/materials/src/composable/index.js (1)
14-21: NewMaterialServicedefinition approved.The addition of
MaterialServicealigns with the project's move fromuseResourcetouseMaterial. The definition is consistent with existing service patterns in the codebase.packages/plugins/materials/index.js (1)
15-24: Export and integration ofMaterialServiceapproved.The addition of
MaterialServiceto the exports and its inclusion in themetasarray are correctly implemented. This change supports the modular architecture of the application.packages/controller/js/preview.js (1)
Line range hint
15-28: Use ofuseMaterialapproved.The integration of
useMaterialis correctly implemented, aligning with the project's shift fromuseResourcetouseMaterial.packages/toolbars/refresh/src/Main.vue (1)
Line range hint
19-39: Integration ofuseMaterialand refresh logic improvements approved.The use of
useMaterialfor clearing block resources and refreshing canvas elements is correctly implemented, enhancing the modularity and maintainability of the code.packages/settings/props/src/components/inputs/BindFunction.vue (2)
15-15: Update import statements to includeuseMaterial.The import statement now correctly includes
useMaterial, aligning with the project's shift fromuseResourcetouseMaterial. Ensure that all functionalities previously handled byuseResourceare now properly managed byuseMaterial.
37-37: Correct usage ofuseMaterialfor material handling.The
useMaterialhook is used to fetch material-related data, which is a part of the new functionality introduced in the application. Verify that thegetMaterialmethod provides all the necessary data previously handled byuseResource.Verification successful
Correct usage of
useMaterialfor material handling.The
getMaterialmethod in bothuseMaterial.jsanduseResource.jshas identical implementations. This confirms that thegetMaterialmethod inuseMaterialprovides all the necessary data previously handled byuseResource. Therefore, the transition touseMaterialshould be seamless without any loss of functionality.
packages/plugins/materials/src/composable/useResource.jspackages/plugins/materials/src/composable/useMaterial.jsScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `getMaterial` method provides all necessary data. # Test: Search for the `getMaterial` usage in the project to ensure it covers all data aspects. rg --type vue $'getMaterial'Length of output: 55
Script:
#!/bin/bash # Corrected script to search for `getMaterial` usage across the project. rg 'getMaterial'Length of output: 3125
Script:
#!/bin/bash # Extract the implementation of `getMaterial` in `useMaterial.js` and `useResource.js` for comparison. ast-grep --lang javascript --pattern 'const getMaterial = $_' --jsonLength of output: 1961
packages/design-core/index.js (1)
18-18: Properly addedMaterialServiceto exports.The inclusion of
MaterialServicealongsideMaterialsandResourceServicein the exports ensures that all related functionalities are accessible from this module. This change supports the broader refactor of material handling in the application.packages/entry/src/hooks.js (1)
21-22: Addition of new hooks for material handling.The new hooks
useMaterialanduseCustomhave been added correctly. This aligns with the application's shift towards more granular control over materials and custom functionalities. Ensure that these hooks are integrated throughout the application where needed.Also applies to: 45-45
Verification successful
Verified integration of
useMaterialanduseCustomhooks across the application.The
useMaterialanduseCustomhooks have been correctly integrated and are being utilized in various parts of the application, as evidenced by the search results.
- Files with
useMaterialanduseCustomusage:
packages/configurator/src/slot-configurator/SlotConfigurator.vuepackages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vuepackages/toolbars/refresh/src/Main.vuepackages/plugins/tree/src/Main.vuepackages/plugins/materials/src/composable/useResource.jspackages/plugins/materials/src/composable/index.jspackages/plugins/materials/src/component/Main.vuepackages/plugins/materials/src/block/Main.vuepackages/plugins/materials/src/block/BlockList.vuepackages/plugins/materials/src/block/BlockGroupPanel.vuepackages/settings/props/src/components/inputs/BindFunction.vuepackages/settings/props/src/composable/useProperties.jspackages/settings/events/src/components/BindEvents.vuepackages/controller/src/index.jspackages/controller/js/preview.jspackages/common/component/ConfigItem.vuepackages/canvas/container/src/CanvasContainer.vuepackages/canvas/container/src/container.jspackages/canvas/container/src/components/shortCutPopover.vuepackages/canvas/container/src/components/CanvasAction.vuepackages/canvas/DesignCanvas/src/DesignCanvas.vueScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of `useMaterial` and `useCustom` hooks across the application. # Test: Search for usages of these hooks to ensure they are being utilized where necessary. rg --type js $'useMaterial|useCustom'Length of output: 5727
packages/canvas/container/src/components/shortCutPopover.vue (2)
33-33: Updated import statement to useuseMaterial.The import statement now includes
useMaterial, which aligns with the project's shift from usinguseResourcetouseMaterial. Ensure that all methods previously accessed throughuseResourceare available and correctly implemented inuseMaterial.
42-42: Correct implementation ofuseMaterial.The
getMaterialmethod is retrieved fromuseMaterial()and used to fetch material configurations based on components. This usage is consistent with the intended functionality ofuseMaterial. Verify thatgetMaterialprovides all necessary data previously handled byuseResource.packages/plugins/page/src/Main.vue (1)
38-38: Updated import statement to include necessary modules.The import now correctly includes
useCanvas,useApp,usePage, anduseHelpfrom@opentiny/tiny-engine-controller. This change is essential for the file's functionality and aligns with the architectural modifications in the project.packages/plugins/materials/src/block/Main.vue (2)
15-15: Updated import statement to useuseMaterial.The import statement correctly includes
useMaterialfrom@opentiny/tiny-engine-controller, which is part of the project's shift towards a more material-centric architecture.
29-29: Correct usage ofuseMaterialin state management and data fetching.The
materialStatefromuseMaterialis used effectively to manage block data. This is a significant change, ensuring that material data is integrated into the block management logic. Verify that all data interactions are correctly handled and that there are no regressions in functionality.Also applies to: 70-77
packages/settings/props/src/components/inputs/DraggableOptions.vue (1)
28-28: Updated import statement to useuseProperties.The import statement correctly includes
usePropertiesfrom@opentiny/tiny-engine-controller, ensuring that property management functionalities are accessible within the component.packages/configurator/src/slot-configurator/SlotConfigurator.vue (2)
28-28: Approved new imports.The inclusion of
useMaterialaligns with the overall PR objectives and the shift fromuseResourcetouseMaterial.
111-111: Good integration ofuseMaterial.The use of
useMaterialto fetch material configurations withintoggleSlotmethod is well-integrated and supports the new functionality introduced by the PR.packages/plugins/materials/src/component/Main.vue (2)
37-37: Approved updated imports for material handling.The inclusion of
useMaterialanduseCanvasaligns with the shift towards a more material-centric architecture.
52-52: Effective use ofuseMaterialfor dynamic component handling.The usage of
useMaterialfor derivinggenerateNodeand managingmaterialStateis crucial for the dynamic functionality of the component panel.packages/settings/props/src/composable/useProperties.js (1)
15-15: Approved the integration ofuseMaterialin property management.The inclusion of
useMaterialalongsideuseCanvasanduseTranslateis well-suited for the new material-centric functionality.packages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vue (1)
51-51: Approved the integration ofuseMaterialfor attribute configuration.The inclusion of
useMaterialaligns with the replacement ofuseResource, enhancing the material management capabilities of the attribute configurator.packages/plugins/materials/src/block/BlockList.vue (2)
20-20: Updated imports for new material handling functionality.The code now imports
useMaterialfrom the tiny-engine-controller, which is part of the effort to shift fromuseResourcetouseMaterial. This change aligns with the project's goal to better manage material-related functionalities.
52-52: Refactor to useuseMaterialfor material management functions.The usage of
generateNodeandregisterBlockfromuseMaterialis appropriate for the component's functionality related to handling blocks. This change is consistent with the overall project's transition from resource to material management.packages/canvas/DesignCanvas/src/DesignCanvas.vue (2)
23-23: Updated imports to includeuseMaterial.The addition of
useMaterialis part of the broader refactoring to use the new material management module, which is a positive change, ensuring that material-related functionalities are handled more robustly.
185-187: Use ofuseMaterialmethods in component methods.The methods
getMaterialandregisterBlockfromuseMaterialare now being used to handle material-specific operations within the canvas. This is a good use of the new module, ensuring that material operations are centralized and consistent.packages/plugins/materials/src/block/BlockGroupPanel.vue (2)
27-27: Refactoring to includeuseMaterialin imports.The inclusion of
useMaterialalongsideuseResourcesuggests a transitional phase where both resource and material functionalities might still be needed. This is a critical step in migrating fully to theuseMaterialmodule.
116-116: Integration ofuseMaterialfor updating canvas dependencies.The use of
useMaterial().updateCanvasDependenciesto handle canvas dependencies after adding blocks is a significant improvement, ensuring that material dependencies are managed efficiently.packages/canvas/container/src/CanvasContainer.vue (2)
33-33: Updated imports to includeuseMaterial.The addition of
useMaterialto the imports is in line with the project's shift towards a more material-centric architecture. This change supports the enhanced management of material-related functionalities within the canvas.
113-113: Use ofuseMaterialto manage third-party dependencies in the canvas.Integrating
useMaterial().materialState.thirdPartyDepsto manage third-party dependencies directly within the canvas setup ensures that material dependencies are handled efficiently and are up-to-date.packages/plugins/materials/src/composable/useMaterial.js (1)
237-240: Remove unnecessary else clause.The
elseclause is redundant after a return statement in the preceding if block. This can simplify the control flow and improve readability.
[REFACTOR_SUGGESTion]- if (response.status === 'fulfilled' && response.value.materials) { - addMaterials(response.value.materials) - } + if (response.status === 'fulfilled' && response.value.materials) addMaterials(response.value.materials);Tools
Biome
[error] 237-238: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
packages/settings/events/src/components/BindEvents.vue (1)
Line range hint
90-113: Update imports and API usage to useuseMaterial.The code correctly updates the imports and API usage to incorporate
useMaterial, aligning with the overall project's shift fromuseResourcetouseMaterial.packages/plugins/tree/src/Main.vue (1)
Line range hint
80-102: Ensure proper use ofuseMaterial.The file correctly replaces
useResourcewithuseMaterial, which is part of the overall refactor in the application. This change is consistent with the new approach to managing materials.packages/common/component/ConfigItem.vue (2)
109-109: Update to useuseMaterial.The import statement correctly includes
useMaterialfrom@opentiny/tiny-engine-controller. This change aligns with the PR's goal to transition fromuseResourcetouseMaterial.
257-257: Ensure proper handling of material data.The usage of
useMaterial().getMaterial(currentComponent)is crucial for fetching material-specific data. Ensure thatcurrentComponentis always defined and valid in this context to prevent runtime errors.packages/canvas/container/src/components/CanvasAction.vue (2)
131-131: Update to useuseMaterial.The import statement correctly includes
useMaterialfrom@opentiny/tiny-engine-controller. This change aligns with the PR's goal to transition fromuseResourcetouseMaterial.
239-239: Ensure proper handling of material data.The usage of
useMaterial().getMaterial(props.selectState.componentName)is crucial for fetching material-specific data. Ensure thatprops.selectState.componentNameis always defined and valid in this context to prevent runtime errors.packages/canvas/container/src/container.js (2)
22-22: Update Import Statement to IncludeuseMaterialThe import statement has been updated to include
useMaterialfrom@opentiny/tiny-engine-controller. This change is consistent with the project's shift fromuseResourcetouseMaterial, as outlined in the PR summary.
920-920: Updated Dependency Management to UseuseMaterialThe dependency update function call has been changed to use
useMaterial().materialState.thirdPartyDepsinstead ofuseResource().resState.thirdPartyDeps. This aligns with the broader refactoring goals of the PR to transition from resource-based to material-based management.
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: 4
Outside diff range and nitpick comments (1)
packages/canvas/container/src/container.js (1)
Line range hint
239-247: Remove redundant else clause.The
elseclause is unnecessary here because theifcondition ends with a return statement, making theelseredundant and less readable.- if (doc) { - doc.dispatchEvent(new CustomEvent(name, data)) - } else { - return - } + if (doc) { + doc.dispatchEvent(new CustomEvent(name, data)) + }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- packages/canvas/container/src/container.js (2 hunks)
- packages/common/component/MetaContainer.vue (2 hunks)
- packages/common/component/MetaTableColumns.vue (1 hunks)
- packages/plugins/block/src/js/blockSetting.jsx (2 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (5 hunks)
- packages/settings/props/src/components/modal/ModalContent.vue (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/plugins/materials/src/composable/useResource.js
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 49-50: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 142-164: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 261-261: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 359-359: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 350-351: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
packages/plugins/block/src/js/blockSetting.jsx
[error] 489-489: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
packages/canvas/container/src/container.js
[error] 239-247: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
Additional comments not posted (13)
packages/common/component/MetaTableColumns.vue (2)
7-7: Ensure unused imports are removed.While the change looks good, ensure that all unused imports are removed to keep the code clean.
11-11: LGTM!The usage of
useMaterialto get the configure map is correctly implemented.packages/common/component/MetaContainer.vue (2)
25-25: Ensure unused imports are removed.While the change looks good, ensure that all unused imports are removed to keep the code clean.
36-36: LGTM!The usage of
useMaterialto get the configure map is correctly implemented.packages/settings/props/src/components/modal/ModalContent.vue (1)
47-47: Update to useuseMaterialinstead ofuseResource.The import should be updated to use
useMaterialto maintain consistency with the refactor.- import { useResource } from '@opentiny/tiny-engine-controller' + import { useMaterial } from '@opentiny/tiny-engine-controller'Likely invalid or redundant comment.
packages/plugins/materials/src/composable/useMaterial.js (6)
271-288: LGTM!
295-303: LGTM!
247-249: LGTM!
207-229: LGTM!
251-254: Avoid usingawaitwithin a loop.Using
awaitwithin a loop can lead to performance issues due to sequential execution. Consider usingPromise.allfor concurrent execution.- const materials = await Promise.allSettled(bundleUrls.map((url) => http.get(url))) + const materials = await Promise.allSettled(bundleUrls.map((url) => http.get(url)))Likely invalid or redundant comment.
261-263: Remove redundant else clause.The
elseclause is unnecessary here because theifcondition ends with a return statement, making theelseredundant and less readable.- if (response.status === 'fulfilled' && response.value.materials) { - addMaterials(response.value.materials) - } + if (response.status === 'fulfilled' && response.value.materials) { + addMaterials(response.value.materials) + }Likely invalid or redundant comment.
Tools
Biome
[error] 261-261: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
packages/plugins/block/src/js/blockSetting.jsx (1)
53-53: LGTM!packages/canvas/container/src/container.js (1)
919-920: LGTM!
…ngine into refactor/useMaterial
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 (1)
packages/plugins/block/src/js/blockSetting.jsx (1)
Line range hint
489-489: Fix parameter order in function definition.This default parameter should follow the last required parameter or should be a required parameter.
- const createOrUpdateCategory = async ({ categoryId, ...params }, isEdit) => { + const createOrUpdateCategory = async (isEdit, { categoryId, ...params }) => {
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue (2 hunks)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/configurator/src/container-configurator/ContainerConfigurator.vue (2 hunks)
- packages/configurator/src/table-columns-configurator/TableColumnsConfigurator.vue (1 hunks)
- packages/entry/src/hooks.js (3 hunks)
- packages/plugins/block/src/js/blockSetting.jsx (2 hunks)
- packages/plugins/materials/index.js (2 hunks)
- packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue (2 hunks)
- packages/plugins/materials/src/meta/block/src/BlockList.vue (2 hunks)
- packages/plugins/materials/src/meta/block/src/Main.vue (3 hunks)
- packages/plugins/materials/src/meta/component/src/Main.vue (2 hunks)
- packages/settings/events/src/components/BindEvents.vue (2 hunks)
- packages/settings/props/src/composable/useProperties.js (2 hunks)
Files skipped from review as they are similar to previous changes (4)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue
- packages/common/component/ConfigItem.vue
- packages/plugins/materials/index.js
- packages/settings/events/src/components/BindEvents.vue
Additional context used
Biome
packages/entry/src/hooks.js
[error] 75-75: The comma operator is disallowed.
Its use is often confusing and obscures side effects.
(lint/style/noCommaOperator)
packages/settings/props/src/composable/useProperties.js
[error] 219-222: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
packages/plugins/block/src/js/blockSetting.jsx
[error] 489-489: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
Additional comments not posted (17)
packages/configurator/src/table-columns-configurator/TableColumnsConfigurator.vue (1)
7-11: LGTM!The refactor to use
useMaterialinstead ofuseResourcelooks good. The changes integrate well with the existing code.packages/configurator/src/container-configurator/ContainerConfigurator.vue (1)
Line range hint
25-36: LGTM!The refactor to use
useMaterialinstead ofuseResourcelooks good. The changes integrate well with the existing code.packages/plugins/materials/src/meta/block/src/Main.vue (4)
19-19: Update import statement.The
useResourcefunction has been replaced withuseMaterialfrom@opentiny/tiny-engine-controller.
43-43: Update function usage.The
materialStateis now being retrieved fromuseMaterial.
84-84: Update function usage.The
blocksproperty is now accessed frommaterialState.
91-91: Update function usage.The
blocksproperty is now accessed frommaterialState.packages/plugins/materials/src/meta/component/src/Main.vue (3)
37-37: Update import statement.The
useResourcefunction has been replaced withuseMaterialfrom@opentiny/tiny-engine-controller.
52-52: Update function usage.The
generateNodeandmaterialStateare now being retrieved fromuseMaterial.
55-55: Update function usage.The
componentsproperty is now accessed frommaterialState.packages/settings/props/src/composable/useProperties.js (2)
15-15: Update import statement.The
useResourcefunction has been replaced withuseMaterialfrom@opentiny/tiny-engine-entry.
163-163: Update function usage.The
getMaterialfunction is now being retrieved fromuseMaterial.packages/plugins/materials/src/meta/block/src/BlockList.vue (2)
20-20: Update import statement to useuseMaterial.The import statement has been updated to replace
useResourcewithuseMaterial.
52-52: Update function calls to useuseMaterial.The function calls have been updated to use
useMaterialinstead ofuseResource.packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue (2)
27-27: Update import statement to useuseMaterial.The import statement has been updated to replace
useResourcewithuseMaterial.
116-116: Update function call to useuseMaterial.The function call has been updated to use
useMaterialinstead ofuseResource.packages/plugins/block/src/js/blockSetting.jsx (2)
27-27: Update import statement to useuseMaterial.The import statement has been updated to replace
useResourcewithuseMaterial.
53-53: Update function call to useuseMaterial.The function call has been updated to use
useMaterialinstead ofuseResource.
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: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/controller/js/preview.js (2 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/controller/js/preview.js
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 49-50: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 257-257: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 355-355: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 346-347: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
Additional comments not posted (13)
packages/plugins/materials/src/composable/useMaterial.js (13)
39-47: LGTM!
68-73: LGTM!
75-84: LGTM!
86-99: LGTM!
148-152: LGTM!
154-155: LGTM!
160-190: LGTM!
197-201: LGTM!
203-225: LGTM!
228-240: LGTM!
243-245: LGTM!
247-251: LGTM!
257-260: Remove redundant else clause.The
elseclause is unnecessary here because theifcondition ends with a return statement, making theelseredundant and less readable.- } else { - addMaterials(response.value.materials) - } + } + addMaterials(response.value.materials);Likely invalid or redundant comment.
Tools
Biome
[error] 257-257: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
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: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/plugins/materials/index.js (1 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
- packages/plugins/materials/src/meta/layout/src/Main.vue (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/plugins/materials/index.js
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 49-50: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 261-261: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 348-348: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
Additional comments not posted (6)
packages/plugins/materials/src/meta/layout/src/Main.vue (5)
53-53: Verify Initialization and Usage ofpluginRegistryData.Ensure that
pluginRegistryDataand its properties are correctly initialized and used to avoid potential runtime errors.
55-55: LGTM!The initialization of
onlyShowDefaultis appropriate.
57-58: LGTM!The initialization of
activeTabIdis appropriate.
62-62: LGTM!The initialization of
tabComponentsis appropriate.
Line range hint
227-228: Verify Initialization and Usage ofmaterialState.blocks.Ensure that
materialState.blocksand its properties are correctly initialized and used to avoid potential runtime errors.packages/plugins/materials/src/composable/useMaterial.js (1)
321-327: Avoid Spread Syntax on Accumulators.Spread syntax should be avoided on accumulators because it causes a time complexity of
O(n^2). Consider using methods such as.spliceor.pushinstead.- componentState.componentsMap = appData.componentsMap?.reduce((componentsMap, component) => { - if (component.dependencies) { - getBlockDeps(component.dependencies) - } - return { ...componentsMap, [component.componentName]: component } - }, {}) + componentState.componentsMap = {}; + appData.componentsMap?.forEach((component) => { + if (component.dependencies) { + getBlockDeps(component.dependencies); + } + componentState.componentsMap[component.componentName] = component; + });Likely invalid or redundant comment.
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: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/entry/src/hooks.js (3 hunks)
- packages/plugins/block/src/js/blockSetting.jsx (2 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/entry/src/hooks.js
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 53-54: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 270-270: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 353-355: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
packages/plugins/block/src/js/blockSetting.jsx
[error] 490-490: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
Additional comments not posted (1)
packages/plugins/block/src/js/blockSetting.jsx (1)
23-24: LGTM!The import statement and the usage of
getMaterialfromuseMaterialalign with the objective of decoupling material-related resources fromuseResource.Also applies to: 54-54
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: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 53-54: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
[error] 270-270: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
Additional comments not posted (9)
packages/plugins/materials/src/composable/useMaterial.js (9)
68-73: LGTM!
79-87: LGTM!
90-103: LGTM!
152-156: LGTM!
158-158: LGTM!
211-234: LGTM!
236-249: LGTM!
251-253: LGTM!
265-272: Remove redundant else clause.The
elseclause is unnecessary because the previous branch ends with a return statement.- if (response.status === 'fulfilled' && response.value.materials) { - addMaterials(response.value.materials) - } else { - // handle other cases - } + if (response.status === 'fulfilled' && response.value.materials) { + addMaterials(response.value.materials); + }Likely invalid or redundant comment.
Tools
Biome
[error] 270-270: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
Additional context used
Biome
packages/plugins/materials/src/composable/useMaterial.js
[error] 274-274: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
Additional comments not posted (19)
packages/plugins/materials/src/composable/useMaterial.js (19)
1-18: LGTM!
39-51: LGTM!
53-66: LGTM!
72-77: LGTM!
83-91: LGTM!
94-107: LGTM!
156-160: LGTM!
162-162: LGTM!
168-198: LGTM!
205-209: LGTM!
215-238: LGTM!
240-252: LGTM!
255-257: LGTM!
283-301: LGTM!
307-315: LGTM!
317-328: LGTM!
330-341: LGTM!
343-357: LGTM!
269-276: Remove redundant else clause.The else clause is unnecessary because the previous branch ends with a return statement.
- materials.forEach((response) => { - if (response.status === 'fulfilled' && response.value.materials) { - addMaterials(response.value.materials) - } - }) + materials.forEach((response) => { + if (response.status === 'fulfilled' && response.value.materials) { + addMaterials(response.value.materials); + } + });Likely invalid or redundant comment.
Tools
Biome
[error] 274-274: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
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: 2
Outside diff range and nitpick comments (2)
packages/plugins/block/src/js/blockSetting.jsx (1)
Line range hint
495-495: Consider adjusting the parameter order in function definitions.The default parameter precedes a required parameter, which can lead to unexpected behavior or errors if not all parameters are provided during a function call. Consider rearranging the parameters to follow best practices.
- function example(defaultParam = 'default', requiredParam) { + function example(requiredParam, defaultParam = 'default') {packages/canvas/container/src/container.js (1)
Line range hint
239-247: Redundant else clause can be omitted.Following the static analysis tool's suggestion, the else clause here is unnecessary because the preceding branches (if and else-if) cover all conditions that would prevent the else branch from executing.
- else { - type = POSITION.BOTTOM; - }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (28)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue (2 hunks)
- packages/canvas/container/src/CanvasContainer.vue (2 hunks)
- packages/canvas/container/src/components/CanvasAction.vue (2 hunks)
- packages/canvas/container/src/components/shortCutPopover.vue (2 hunks)
- packages/canvas/container/src/container.js (2 hunks)
- packages/common/component/ConfigItem.vue (2 hunks)
- packages/common/js/preview.js (2 hunks)
- packages/configurator/src/container-configurator/ContainerConfigurator.vue (2 hunks)
- packages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vue (2 hunks)
- packages/configurator/src/slot-configurator/SlotConfigurator.vue (2 hunks)
- packages/configurator/src/table-columns-configurator/TableColumnsConfigurator.vue (1 hunks)
- packages/design-core/index.js (1 hunks)
- packages/plugins/block/src/js/blockSetting.jsx (2 hunks)
- packages/plugins/materials/src/composable/index.js (2 hunks)
- packages/plugins/materials/src/composable/useMaterial.js (1 hunks)
- packages/plugins/materials/src/composable/useResource.js (5 hunks)
- packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue (2 hunks)
- packages/plugins/materials/src/meta/block/src/BlockList.vue (2 hunks)
- packages/plugins/materials/src/meta/block/src/Main.vue (3 hunks)
- packages/plugins/materials/src/meta/component/src/Main.vue (2 hunks)
- packages/plugins/materials/src/meta/layout/src/Main.vue (1 hunks)
- packages/plugins/page/src/Main.vue (3 hunks)
- packages/plugins/tree/src/Main.vue (2 hunks)
- packages/register/src/hooks.js (3 hunks)
- packages/settings/events/src/components/BindEvents.vue (2 hunks)
- packages/settings/props/src/components/inputs/BindFunction.vue (2 hunks)
- packages/settings/props/src/components/inputs/DraggableOptions.vue (3 hunks)
- packages/settings/props/src/composable/useProperties.js (2 hunks)
Files skipped from review due to trivial changes (1)
- packages/plugins/materials/src/meta/block/src/BlockGroupPanel.vue
Files skipped from review as they are similar to previous changes (21)
- packages/canvas/DesignCanvas/src/DesignCanvas.vue
- packages/canvas/container/src/CanvasContainer.vue
- packages/canvas/container/src/components/CanvasAction.vue
- packages/canvas/container/src/components/shortCutPopover.vue
- packages/common/component/ConfigItem.vue
- packages/configurator/src/container-configurator/ContainerConfigurator.vue
- packages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vue
- packages/configurator/src/slot-configurator/SlotConfigurator.vue
- packages/configurator/src/table-columns-configurator/TableColumnsConfigurator.vue
- packages/design-core/index.js
- packages/plugins/materials/src/composable/index.js
- packages/plugins/materials/src/composable/useResource.js
- packages/plugins/materials/src/meta/block/src/BlockList.vue
- packages/plugins/materials/src/meta/block/src/Main.vue
- packages/plugins/materials/src/meta/component/src/Main.vue
- packages/plugins/materials/src/meta/layout/src/Main.vue
- packages/plugins/page/src/Main.vue
- packages/plugins/tree/src/Main.vue
- packages/settings/events/src/components/BindEvents.vue
- packages/settings/props/src/components/inputs/BindFunction.vue
- packages/settings/props/src/components/inputs/DraggableOptions.vue
Additional context used
Biome
packages/common/js/preview.js
[error] 31-31: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
packages/settings/props/src/composable/useProperties.js
[error] 219-222: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
packages/plugins/materials/src/composable/useMaterial.js
[error] 274-274: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
packages/plugins/block/src/js/blockSetting.jsx
[error] 495-495: This default parameter should follow the last required parameter or should be a required parameter.
The last required parameter is here:
A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.(lint/style/useDefaultParameterLast)
packages/canvas/container/src/container.js
[error] 239-247: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
Additional comments not posted (10)
packages/common/js/preview.js (1)
15-15: Correct import ofuseMaterial.The import of
useMaterialaligns with the PR's objectives to decouple material-related functionalities fromuseResource.packages/register/src/hooks.js (2)
21-22: Proper integration of new hooks.The addition of
useMaterialanduseCustomhooks aligns with the decoupling efforts and extends the functionality of the hooks system.Also applies to: 45-45
75-75: Correct definition ofuseMaterialhook function.The
useMaterialfunction is defined correctly and follows the established pattern for hook functions in this file.packages/settings/props/src/composable/useProperties.js (1)
15-15: Correct integration ofuseMaterial.The import and usage of
useMaterialare correctly implemented, aligning with the decoupling efforts of the PR.packages/plugins/materials/src/composable/useMaterial.js (2)
115-153: Remove redundant else clause and simplify nested structure.This suggestion was previously made and is still applicable. Simplifying the nested structure improves readability and maintainability.
274-274: Remove unnecessary else clause.This suggestion was previously made and is still valid. Removing the unnecessary else clause simplifies the control flow.
Tools
Biome
[error] 274-274: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
packages/plugins/block/src/js/blockSetting.jsx (2)
25-25: Import ofuseMaterialis properly added.The import of
useMaterialis correctly integrated to align with the project's shift fromuseResourcetouseMaterial. This change is consistent with the PR's objectives and the broader refactoring efforts across the project.
54-54: Proper usage ofuseMaterialfor accessinggetMaterial.The line correctly uses the
useMaterialhook to access thegetMaterialmethod. This is part of the project's initiative to centralize material-related functionalities, enhancing modularity and maintainability.packages/canvas/container/src/container.js (2)
22-22: Update import to includeuseMaterial.The import statement correctly includes
useMaterialalong with other hooks. This change is necessary for the new functionality introduced in the PR and aligns with the project's direction.
919-920: Correct integration ofuseMaterialfunctions ininitCanvas.The use of
useMaterial().getConfigureMap()anduseMaterial().materialState.thirdPartyDepsin theinitCanvasfunction is appropriate and aligns with the PR's objectives to centralize material-related functionalities.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/common/js/preview.js (2 hunks)
- packages/settings/props/src/composable/useProperties.js (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/common/js/preview.js
Additional context used
Biome
packages/settings/props/src/composable/useProperties.js
[error] 219-222: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Additional comments not posted (1)
packages/settings/props/src/composable/useProperties.js (1)
15-15: Update the import statement.The import of
useMaterialreplacesuseResource. Ensure thatuseMaterialis correctly used throughout the codebase.Verification successful
Update the import statement.
The import of
useMaterialreplacesuseResource. The usage ofuseMaterialhas been verified throughout the codebase.
packages/settings/props/src/composable/useProperties.jspackages/register/src/hooks.jspackages/canvas/container/src/CanvasContainer.vuepackages/canvas/DesignCanvas/src/DesignCanvas.vuepackages/canvas/container/src/container.jspackages/canvas/container/src/components/shortCutPopover.vuepackages/canvas/container/src/components/CanvasAction.vuepackages/common/js/preview.jspackages/common/component/ConfigItem.vuepackages/configurator/src/slot-configurator/SlotConfigurator.vuepackages/configurator/src/table-columns-configurator/TableColumnsConfigurator.vuepackages/configurator/src/html-attributes-configurator/HtmlAttributesConfigurator.vuepackages/configurator/src/container-configurator/ContainerConfigurator.vuepackages/toolbars/refresh/src/Main.vuepackages/plugins/tree/src/Main.vuepackages/plugins/materials/src/composable/useResource.jspackages/plugins/materials/src/composable/index.jspackages/plugins/materials/src/meta/block/src/Main.vuepackages/plugins/materials/src/meta/block/src/BlockList.vuepackages/plugins/materials/src/meta/component/src/Main.vuepackages/plugins/materials/src/meta/block/src/BlockGroupPanel.vuepackages/settings/events/src/components/BindEvents.vuepackages/settings/props/src/components/inputs/BindFunction.vueScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `useMaterial` in the codebase. # Test: Search for the function usage. Expect: Only occurrences of `useMaterial`. rg --type js --type vue $'useMaterial'Length of output: 65
Script:
#!/bin/bash # Description: Verify the usage of `useMaterial` in the codebase. # Test: Search for the function usage in .js and .vue files. Expect: Only occurrences of `useMaterial`. rg --glob '*.js' --glob '*.vue' 'useMaterial'Length of output: 6185
…ce (opentiny#591) * refactor(material): 将物料(组件,区块)从resource剥离出来 * refactor(useMaterial): useResource拆分 * refactor(useMaterial): 机器人review意见修改 * refactor(useMaterial): review意见修改 * refactor(useMaterials): 更新冲突后的调整,以及增加注释 * refactor(useMaterials): review bot * refactor(useMaterials): review bot * fix: sync update * refactor(useMaterials): review bot --------- Co-authored-by: chilingling <[email protected]>
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
useResourcetouseMaterialfor enhanced retrieval of third-party dependencies.