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

refactor: solved the bug mentioned in #246 #247

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

Girishbari
Copy link
Contributor

Related Issue

Fix: #246

Description

.map method in EditorMenuBar.tsx and Markdown.tsx does not had unique KEY prop it was an earlier item.title whereas the title was not unique which caused the issue

Screenshots

current behaviour of console
image

current errors are not related with above issue

Copy link

vercel bot commented Feb 12, 2024

Someone is attempting to deploy a commit to a Personal Account owned by @Sanchitbajaj02 on Vercel.

@Sanchitbajaj02 first needs to authorize it.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, @Girishbari! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project. Keep being the part of the community!

'We will promptly review your changes and offer feedback. Keep up the excellent work!
Kindly remember to check our Contributing Guidelines'

@github-actions github-actions bot added wait for reviewers SWOC S4 Social Winter of Code (S4) 2024 contribution tag labels Feb 12, 2024
Copy link

vercel bot commented Feb 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
palettegram ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2024 4:21pm

@Sanchitbajaj02 Sanchitbajaj02 added 🪲 bug Something isn't working 🛠 goal: fix The label is related to fixing a bug EASY Difficulty Level: Easy and removed wait for reviewers labels Feb 13, 2024
Copy link
Contributor

coderabbitai bot commented Feb 13, 2024

Walkthrough

The updates enhance the editor's functionality by introducing new menu items for text formatting (bold, italic, etc.) and improving the mapping functions in two components for better key management. This directly addresses the issue with non-unique keys in .map loops, ensuring a more stable and efficient rendering process.

Changes

File Path Change Summary
src/components/Editor/.../EditorMenuBar.tsx Added menu items with unique IDs for various formatting options.
src/components/Editor/.../Markdown.tsx Modified mapping functions to include index parameter for unique key attributes in components.

Assessment against linked issues

Objective Addressed Explanation
Unique KEY prop in .map loop (#246)

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 67d4e6c and 398bb3f.
Files selected for processing (2)
  • src/components/Editor/EditorMenuBar.tsx (2 hunks)
  • src/components/Editor/Markdown.tsx (2 hunks)
Additional comments: 1
src/components/Editor/EditorMenuBar.tsx (1)
  • 24-147: The addition of unique IDs for new menu items is a good practice and enhances the editor's functionality. Ensure that these IDs remain unique as more items are added in the future.

Comment on lines +110 to +112
BubbleMenuFunctions.map((func, index) => (
<button
key={func.title}
key={index}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using index as a key is a valid workaround for non-unique keys but can lead to performance issues and bugs in dynamic lists. Consider using a more stable and unique identifier if possible.

Comment on lines +135 to +137
FloatingMenuFunctions.map((func, index) => (
<button
key={func.title}
key={index}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous comment, using index as a key here is a workaround. Advise considering more stable and unique identifiers for keys to avoid potential issues in dynamic lists.

@Sanchitbajaj02 Sanchitbajaj02 merged commit faf1a09 into Sanchitbajaj02:master Feb 13, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working EASY Difficulty Level: Easy 🛠 goal: fix The label is related to fixing a bug SWOC S4 Social Winter of Code (S4) 2024 contribution tag
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: problem in .map loop
2 participants