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

Revert "Scale fields in components (#7213)" #7253

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

Diamekod0221
Copy link
Contributor

@Diamekod0221 Diamekod0221 commented Nov 27, 2024

This reverts commit 1a4c2d0.

Describe your changes

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

Summary by CodeRabbit

  • New Features

    • Enhanced styling for the MuiDataGrid component's column headers.
  • Bug Fixes

    • Downgraded versions of Material-UI packages to improve compatibility and stability.
  • Refactor

    • Updated column definitions in the ComponentTable component for better type management and layout adjustments.
  • Style

    • Minor formatting improvements in the NodeInput component for cleaner code structure.

Copy link

coderabbitai bot commented Nov 27, 2024

📝 Walkthrough

Walkthrough

The pull request includes several updates primarily focused on the dependency management of Material-UI packages across multiple files. In the package.json for both the nussknacker-designer-client and the @nu/components package, the versions of @mui/icons-material, @mui/material, and @mui/lab have been downgraded to address potential compatibility or stability issues. Specifically, @mui/icons-material and @mui/material were downgraded from version 5.16.7 to 5.15.7, and @mui/lab was downgraded from 5.0.0-alpha.173 to 5.0.0-alpha.165. Additionally, @mui/system was removed from the dependencies.

Minor formatting changes were made in the NodeInput.tsx file, while the defaultTheme.tsx file saw updates to the useDefaultTheme function, enhancing the styling of the MuiDataGrid component's column headers. Lastly, in componentTable.tsx, the type definition for columns was modified, and an unused import was removed, indicating a refinement in the component's structure.

Possibly related PRs

  • Scale fields in components #7213: This PR involves updates to the package.json file for the nussknacker-designer-client, specifically downgrading the same Material-UI packages (@mui/icons-material, @mui/material) as in the main PR, indicating a direct relationship in dependency management.

Suggested labels

ui, client, submodules

Suggested reviewers

  • Dzuming

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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 (2)
designer/submodules/packages/components/src/common/defaultTheme.tsx (1)

75-77: Consider the visual impact of the background color blend.

The blendLighten function with a value of 0.12 is being used to create a subtle contrast for the column headers. While this works, consider:

  1. Testing this in both light and dark themes to ensure sufficient contrast
  2. Documenting the rationale for the specific blend value of 0.12
designer/client/package.json (1)

Based on the search results, I can now generate the final response:

@mui/system removal is safe with minor adjustments needed

The package is not directly used as a main dependency, but there are specific imports from its submodules that need attention:

  • getLuminance from "@mui/system/colorManipulator" (used in multiple files)
  • blend from "@mui/system" (used in theme helpers and styling)

These imports should be updated to use equivalent functions from @mui/material instead, as these utilities are also available there. Specific files to update:

  • designer/client/src/containers/theme/helpers.ts
  • designer/client/src/components/graph/EspNode/element.ts
  • designer/client/src/components/ComponentPreview.tsx
  • designer/client/src/components/toolbars/activities/helpers/activityItemColors.ts
  • designer/client/src/stylesheets/SelectStyled.ts
  • And other files using these utilities
🔗 Analysis chain

Line range hint 1-300: Verify impact of @mui/system removal

The removal of @mui/system package needs careful verification as it might break existing styling implementations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for @mui/system usage and potential breaking changes

# Search for direct imports of @mui/system
rg "from '@mui/system'" --type ts --type tsx -A 3

# Search for specific @mui/system utilities
rg "styled|Box|createTheme|ThemeProvider" --type ts --type tsx -A 3

# Look for any remaining references to @mui/system in other package files
fd package.json --exec jq -r 'select(.dependencies != null) | select(.dependencies["@mui/system"] != null)'

Length of output: 293


Script:

#!/bin/bash
# Let's try a different approach to search for @mui/system usage

# Search for direct imports without file type restrictions
rg "from ['|\"]@mui/system" -A 3

# Search for specific @mui/system utilities without file type restrictions
rg "import.*?{.*?(styled|Box|createTheme|ThemeProvider).*?}.*?from ['|\"]@mui/(system|material)" -A 3

# Look for any remaining references to @mui/system in package.json files
find . -name "package.json" -type f -exec grep -l "@mui/system" {} \;

Length of output: 6140

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between aa609c0 and a3406ee.

⛔ Files ignored due to path filters (3)
  • designer/client/package-lock.json is excluded by !**/package-lock.json
  • designer/client/test/Process/__snapshots__/ProcessStateIcon-test.tsx.snap is excluded by !**/*.snap
  • designer/submodules/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • designer/client/package.json (1 hunks)
  • designer/client/src/components/NodeInput.tsx (1 hunks)
  • designer/submodules/packages/components/package.json (1 hunks)
  • designer/submodules/packages/components/src/common/defaultTheme.tsx (1 hunks)
  • designer/submodules/packages/components/src/components/componentTable.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • designer/client/src/components/NodeInput.tsx
🔇 Additional comments (6)
designer/submodules/packages/components/package.json (2)

12-13: Ensure version parity between @mui/material and @mui/icons-material

The synchronized downgrade to 5.15.7 for both packages maintains version parity, which is good practice.


12-14: ⚠️ Potential issue

Verify compatibility and impact of MUI package downgrades

The significant version downgrades warrant careful consideration:

  1. @mui/material & @mui/icons-material: 5.16.7 -> 5.15.7
  2. @mui/x-data-grid: 7.22.2 -> 6.18.5 (major version downgrade)

Consider documenting:

  1. The reason for reverting to these specific versions
  2. Any known compatibility issues or limitations
  3. Migration steps if breaking changes affect the codebase

The major version downgrade of @mui/x-data-grid (7.x -> 6.x) likely introduces breaking changes. Please ensure:

  1. All DataGrid usage patterns are compatible with v6.x
  2. Features specific to v7.x are not being used
  3. TypeScript types are updated accordingly
✅ Verification successful

Let me gather more information about DataGrid usage patterns with a different approach since the previous typescript file type wasn't recognized.


Let me check the actual DataGrid usage patterns in the affected files to understand the impact.


Based on the gathered evidence, I can now provide a final response:

DataGrid downgrade requires attention to specific usage patterns

The version downgrade from 7.x to 6.x of @mui/x-data-grid impacts several files that use DataGrid features:

  • Basic DataGrid usage in tableWrapper.tsx with standard props (autoPageSize, rows, getRowHeight)
  • Custom styling in defaultTheme.tsx using MuiDataGrid style overrides
  • Simple id mapping for DataGrid in useScenariosQuery.tsx
  • Basic hover styles in tableCellAvatar.tsx

The current implementation appears to use basic DataGrid features that are stable across v6 and v7, and no v7-specific features were detected in the codebase. The coordinated downgrade of @mui/material and @mui/icons-material to 5.15.7 maintains version compatibility.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes and security advisories

# Search for MUI DataGrid usage patterns that might be affected by the downgrade
echo "Checking for DataGrid usage patterns..."
rg -l "DataGrid|useDataGrid" --type typescript --type typescript-react

# Check for security advisories
echo "Checking for security advisories..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "@mui/material") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# Check peer dependency requirements
echo "Checking package.json files for potential conflicts..."
fd package.json --type f --exec jq -r '.dependencies | select(. != null) | with_entries(select(.key | startswith("@mui"))) // empty'

Length of output: 1076


Script:

#!/bin/bash
# Search for DataGrid usage patterns with ripgrep
echo "Checking for DataGrid usage patterns..."
rg -l "DataGrid|useDataGrid"

# Check the specific version changes in git history
echo "Checking version changes in package.json..."
git show HEAD -- designer/submodules/packages/components/package.json

# Look for potential breaking changes in documentation files
echo "Checking for migration or breaking changes documentation..."
rg -i "breaking.*changes|migration|upgrade" -g "*.md"

Length of output: 12438


Script:

#!/bin/bash
# Check DataGrid usage in the identified files
echo "Checking DataGrid implementation details..."
rg -A 5 -B 5 "DataGrid|useDataGrid" designer/submodules/packages/components/src/components/tableWrapper.tsx designer/submodules/packages/components/src/common/defaultTheme.tsx designer/submodules/packages/components/src/scenarios/useScenariosQuery.tsx designer/submodules/packages/components/src/scenarios/list/tableCellAvatar.tsx

# Check for any package-lock.json or yarn.lock to verify dependency resolution
echo "Checking lock files..."
fd "package-lock.json|yarn.lock" --type f --exec head -n 20 {}

Length of output: 9027

designer/submodules/packages/components/src/components/componentTable.tsx (2)

9-9: LGTM! Import statement is correctly maintained.

The import of GridActionsCellItem is necessary and properly used in the component.


18-25: Verify the impact of reduced flex value on name column width.

The flex value for the name column has been significantly reduced from 4 to 1, while other columns maintain larger flex values (e.g., categories with flex: 4). This change might:

  • Make the name column too narrow for longer component names
  • Create an unbalanced table layout
  • Affect overall readability
designer/submodules/packages/components/src/common/defaultTheme.tsx (1)

75-77: Verify the compatibility of the new style with downgraded Material-UI version.

The addition of columnHeadersInner style override might be affected by the Material-UI downgrade mentioned in the PR summary (from 5.16.7 to 5.15.7). Please ensure this styling property is supported in the downgraded version.

✅ Verification successful

The style override is compatible with the downgraded Material-UI version

The columnHeadersInner style is a valid style override for MUI DataGrid in version 5.15.7. The blendLighten function is a custom utility that's consistently used across the codebase for styling purposes, and the style property is applied to a standard background color property. The downgrade from 5.16.7 to 5.15.7 is a minor version change that doesn't affect DataGrid styling APIs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes in MUI DataGrid styling between versions

# Search for any DataGrid-related changes in the codebase that might need similar updates
rg -g '*.tsx' -g '*.ts' 'columnHeadersInner' 

# Look for any migration guides or documentation files that might contain relevant information
fd -g 'MIGRATION*.md' -g 'CHANGELOG*.md'

Length of output: 306


Script:

#!/bin/bash
# Let's check for any DataGrid-related styling patterns and imports
rg -g '*.tsx' -g '*.ts' 'MuiDataGrid' -A 5 -B 5

# Search for any other usage of blendLighten function
rg -g '*.tsx' -g '*.ts' 'blendLighten'

# Look for package.json to verify MUI versions
fd -g 'package.json' --exec cat {} 

Length of output: 28040

designer/client/package.json (1)

14-16: Verify MUI package compatibility after version downgrades

The downgrade of Material-UI packages to earlier versions requires careful verification:

  • @mui/icons-material: 5.16.7 → 5.15.7
  • @mui/lab: 5.0.0-alpha.173 → 5.0.0-alpha.165
  • @mui/material: 5.16.7 → 5.15.7

Consider the following recommendations:

  1. Document the reason for the version downgrades in the PR description to help with future maintenance
  2. Add a package.json comment explaining why specific versions are required
  3. Consider implementing a version constraint (e.g., ~5.15.7) to allow patch updates while preventing minor version bumps
✅ Verification successful

Version downgrade is safe to proceed

Based on the analysis of the codebase:

  1. The @mui/system package removal is safe as its usage is limited to styling utilities that are also available through @mui/material.
  2. The @mui/lab usage is minimal, only importing LoadingButton which has been stable across the versions being changed.
  3. The version changes (5.16.7 → 5.15.7) are minor version downgrades that maintain compatibility within the v5.x series.
  4. The package versions are consistently aligned across all dependencies in the monorepo.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential peer dependency conflicts and usage patterns

# Check for peer dependency requirements in package-lock.json
fd package-lock.json --exec jq -r '.packages | .[] | select(.dependencies != null) | select(.dependencies["@mui/material"] != null or .dependencies["@mui/icons-material"] != null or .dependencies["@mui/lab"] != null) | {name: .name, dependencies: .dependencies}'

# Look for direct Material-UI component usage
rg -l '@mui/(material|icons-material|lab)' --type ts --type tsx

# Check for @mui/system imports that might break after removal
rg -l '@mui/system' --type ts --type tsx

Length of output: 4266


Script:

#!/bin/bash
# Let's try a different approach to find MUI usage without file type restrictions

# Check for MUI imports
rg -l '@mui/(material|icons-material|lab)'

# Check for @mui/system imports specifically
rg -l '@mui/system'

# Check if there are any explicit version requirements in other package.json files
fd package.json --exec grep -l "@mui/" {} \;

# Look for potential breaking changes by searching for specific MUI components or patterns
rg "import.*@mui/lab" -A 2

Length of output: 20698

@Diamekod0221 Diamekod0221 merged commit 0f94b80 into staging Nov 27, 2024
13 checks passed
@Diamekod0221 Diamekod0221 deleted the revert_name_scaling branch November 27, 2024 12:18
@coderabbitai coderabbitai bot mentioned this pull request Nov 27, 2024
9 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant