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

feat(rsc): Detect single RSA functions (not just entire files) #11168

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Aug 7, 2024

Our "analyze" vite plugin now also finds inlined RSAs.

export const ServerDelayForm = () => {
  let delay = 0;

  if (fs.existsSync("settings.json")) {
    delay = JSON.parse(fs.readFileSync("settings.json", "utf8")).delay || 0
  }
 
  return (
    <div className="server-delay-form">
      <form
        action={async (formData) => {
          // The "use server" here is what's interesting and important
          "use server"

          await fs.promises.writeFile(
            "settings.json",
            `{ "delay": ${formData.get("delay") } }\n`
          )
        }}
      >
        <label htmlFor="delay">
          <div>Delay ({delay}ms)</div>
          <input type="number" id="delay" name="delay" />
        </label>
        <button type="submit">Set</button>
      </form>
    </div>
  )
}

@Tobbe Tobbe added release:feature This PR introduces a new feature experimental This PR relates to only experimental feature(s) labels Aug 7, 2024
@Tobbe Tobbe added this to the next-release-patch milestone Aug 7, 2024
@Tobbe Tobbe added the changesets-ok Override the changesets check label Aug 7, 2024
@Tobbe Tobbe merged commit 72b7619 into redwoodjs:main Aug 7, 2024
51 of 52 checks passed
@Tobbe Tobbe deleted the tobbe-rsc-detect-single-rsa-function branch August 7, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changesets-ok Override the changesets check experimental This PR relates to only experimental feature(s) release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants