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

fix[gen2-sdks]: add keys for Fragment inside Accordion JSX loop #3725

Closed
wants to merge 4 commits into from

Conversation

oxcabe
Copy link
Contributor

@oxcabe oxcabe commented Nov 7, 2024

Description

This PR adds the key attribute inside the Accordion component. This attribute is required by React's use of loops in JSX code, and will throw an error when the top-level children in a loop are missing this attribute.

From the TypeScript handbook on JSX.IntrinsicAttributes:

Additionally, the JSX.IntrinsicAttributes interface can be used to specify extra properties used by the JSX framework which are not generally used by the components’ props or arguments - for instance key in React. Specializing further, the generic JSX.IntrinsicClassAttributes type may also be used to specify the same kind of extra attributes just for class components (and not Function Components). In this type, the generic parameter corresponds to the class instance type. In React, this is used to allow the ref attribute of type Ref. Generally speaking, all of the properties on these interfaces should be optional, unless you intend that users of your JSX framework need to provide some attribute on every tag.

Additional concerns

Although this is more a situation exclusively about Mitosis, I wanted to, at least, mention it here.

I'd argue that the key attribute, being intrinsic to React's use of JSX, should be managed accordingly inside Mitosis heuristics in order to avoid polluting the Mitosis JSX markup with references to specific transpiler back-ends. Moreover, how could we do the same we're doing in this commit if we were to use Sveltosis instead?

For this reason, I want to propose considering this a temporary fix and solve the problem in the right context, which would be Mitosis handling of key attributes in loops.

@oxcabe oxcabe requested review from samijaber and a team as code owners November 7, 2024 11:56
Copy link

changeset-bot bot commented Nov 7, 2024

🦋 Changeset detected

Latest commit: 3310c98

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@builder.io/sdk-angular Patch
@builder.io/sdk-qwik Patch
@builder.io/sdk-react Patch
@builder.io/sdk-react-native Patch
@builder.io/sdk-solid Patch
@builder.io/sdk-svelte Patch
@builder.io/sdk-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

nx-cloud bot commented Nov 7, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 27f6e9b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx test @snippet/angular-ssr
nx test @snippet/angular
nx test @snippet/react
nx test @e2e/react-sdk-next-pages
nx test @e2e/solid-start
nx test @e2e/solid
nx test @snippet/solid

Sent with 💌 from NxCloud.

Copy link

gitguardian bot commented Jan 8, 2025

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
9508867 Triggered Generic High Entropy Secret cca4410 packages/react/src/blocks/Video.tsx View secret
314150 Triggered Generic High Entropy Secret cca4410 packages/react/src/blocks/Video.tsx View secret
14200383 Triggered Generic High Entropy Secret cca4410 packages/core/src/builder.class.test.ts View secret
14200385 Triggered Generic High Entropy Secret cca4410 packages/core/src/builder.class.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link
Contributor

@samijaber samijaber left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this helpful contribution 🙏🏽

@samijaber
Copy link
Contributor

@oxcabe Github is acting up and not running the CI tests on your PR. I've re-raised the PR over at #3813 to work around this problem.

@samijaber samijaber closed this Jan 8, 2025
samijaber added a commit that referenced this pull request Jan 15, 2025
## Description

Identical to #3725. For some reason, the other PR isn't running CI test
jobs properly, so I'm making a new PR

---------

Co-authored-by: Óscar Carrasco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants