Skip to content

Conversation

@mrazauskas
Copy link
Contributor

@mrazauskas mrazauskas commented Jul 4, 2025

This improves exclude patterns of 'tsconfig.json'. See inline comments of the details.

Currently dist/__tests__ and dist/__typetest__ are emitted. The postbuild deletes dist/__tests__, but dist/__typetest__ are shipped to npm registry. This change makes sure no test files are emitted to the dist directory. That build time shortens and the shipped packed becomes smaller too.

external: Object.keys(pkg.peerDependencies),
plugins: [
typescript({
tsconfig: options.tsconfig,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is always undefined in current setup.

typescript({
tsconfig: options.tsconfig,
clean: true,
exclude: ['**/__tests__', '**/*.test.ts', '**/__typetest__'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duplication.

Comment on lines -21 to +22
"include": ["src"],
"exclude": [
"node_modules",
"app",
"examples",
"cypress",
"src/*.test.ts",
"src/*.test.tsx",
"src/*.test-d.ts",
"src/*.test-d.tsx",
"src/__mocks__"
]
"include": ["src/**/*"],
"exclude": ["**/__tests__/**/*", "**/__typetest__/**/*"]
Copy link
Contributor Author

@mrazauskas mrazauskas Jul 4, 2025

Choose a reason for hiding this comment

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

The include pattern specifies that only files from the src directory should be included. exclude is applied after includes are resolved. The src directory does not have any nested directories like node_modules, app, examples, cypress. Also src/__mocks__ does not exist. These can be removed, I think.

The test currently live under src/__tests_/* and src/__typetest_/*, but these are not excluded by src/*.test.ts or src/*.test-d.ts. The **/ is missing in these globs.

The added **/__tests__/**/* and **/__typetest__/**/* are targeting the test files. This means neither tests nor type tests will be emitted to the dist directory. (In contrary current npm package ships with the type tests.)

Comment on lines -15 to -16
"dist",
"dist/__tests__"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently dist/__tests__ is deleted explicitly by the postbuild script.

This change excludes emitting anything to dist/__tests__.

Copy link
Member

@bluebill1049 bluebill1049 left a comment

Choose a reason for hiding this comment

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

LGTM, nice clean up.

@bluebill1049 bluebill1049 merged commit e47b39e into react-hook-form:master Jul 5, 2025
6 checks passed
@mrazauskas mrazauskas deleted the improve-exclude-patterns branch July 5, 2025 04:09
EItanya pushed a commit to kagent-dev/kagent that referenced this pull request Aug 15, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade react-hook-form from 7.58.1 to
7.61.0.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **4 versions** ahead of your current
version.

- The recommended version was released **21 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>react-hook-form</b></summary>
    <ul>
      <li>
<b>7.61.0</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.61.0">2025-07-23</a></br><p>🧮
feat: compute prop for useWatch subscription (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2761362352" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12503"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12503/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12503">#12503</a>)</p>
<ul>
<li>subscribe to the entire form but only return updated value with
certain condition</li>
</ul>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="type FormValue = {
  test: string;
}

const watchedValue = useWatch({
  control: methods.control,
  compute: (data: FormValue) =&gt; {
    if (data.test?.length) {
      return data.test;
    }

    return '';
  },
});"><pre><span class="pl-k">type</span> <span
class="pl-smi">FormValue</span> <span class="pl-c1">=</span> <span
class="pl-kos">{</span>
<span class="pl-c1">test</span>: <span class="pl-smi">string</span><span
class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">const</span> <span class="pl-s1">watchedValue</span>
<span class="pl-c1">=</span> <span class="pl-en">useWatch</span><span
class="pl-kos">(</span><span class="pl-kos">{</span>
<span class="pl-c1">control</span>: <span
class="pl-s1">methods</span><span class="pl-kos">.</span><span
class="pl-c1">control</span><span class="pl-kos">,</span>
<span class="pl-en">compute</span>: <span class="pl-kos">(</span><span
class="pl-s1">data</span>: <span class="pl-smi">FormValue</span><span
class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span
class="pl-kos">{</span>
<span class="pl-k">if</span> <span class="pl-kos">(</span><span
class="pl-s1">data</span><span class="pl-kos">.</span><span
class="pl-c1">test</span><span class="pl-kos">?.</span><span
class="pl-c1">length</span><span class="pl-kos">)</span> <span
class="pl-kos">{</span>
<span class="pl-k">return</span> <span class="pl-s1">data</span><span
class="pl-kos">.</span><span class="pl-c1">test</span><span
class="pl-kos">;</span>
    <span class="pl-kos">}</span>

<span class="pl-k">return</span> <span class="pl-s">''</span><span
class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span
class="pl-kos">;</span></pre></div>
<ul>
<li>subscribe to a specific form value state</li>
</ul>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="type FormValue = {
  test: string;
}

const watchedValue = useWatch({
  control: methods.control,
  name: 'test',
  compute: (data: string) =&gt; {
      return data.length &gt; 3 ? data : '';
  },
});"><pre><span class="pl-k">type</span> <span
class="pl-smi">FormValue</span> <span class="pl-c1">=</span> <span
class="pl-kos">{</span>
<span class="pl-c1">test</span>: <span class="pl-smi">string</span><span
class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">const</span> <span class="pl-s1">watchedValue</span>
<span class="pl-c1">=</span> <span class="pl-en">useWatch</span><span
class="pl-kos">(</span><span class="pl-kos">{</span>
<span class="pl-c1">control</span>: <span
class="pl-s1">methods</span><span class="pl-kos">.</span><span
class="pl-c1">control</span><span class="pl-kos">,</span>
<span class="pl-c1">name</span>: <span class="pl-s">'test'</span><span
class="pl-kos">,</span>
<span class="pl-en">compute</span>: <span class="pl-kos">(</span><span
class="pl-s1">data</span>: <span class="pl-smi">string</span><span
class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span
class="pl-kos">{</span>
<span class="pl-k">return</span> <span class="pl-s1">data</span><span
class="pl-kos">.</span><span class="pl-c1">length</span> <span
class="pl-c1">&gt;</span> <span class="pl-c1">3</span> ? <span
class="pl-s1">data</span> : <span class="pl-s">''</span><span
class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span
class="pl-kos">;</span></pre></div>
<p>👨‍🔧 trigger watch callbacks in response to value changes only (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3210030061" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12945"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12945/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12945">#12945</a>)<br>
🙏 track name with setValue subscription callbacks (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3210194804" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12946"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12946/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12946">#12946</a>)<br>
⌨️ fix: watch return type based on defaultValue (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3156326445" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12896"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12896/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12896">#12896</a>)<br>
🐞 fix <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="3226443079" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12959"
data-hovercard-type="issue"
data-hovercard-url="/react-hook-form/react-hook-form/issues/12959/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/issues/12959">#12959</a>
subscribe with latest defaultValues <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3226946310"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12961"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12961/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12961">#12961</a><br>
🐞 fix: handle explicit "multipart/form-data" encType in Form Component
(<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3212769870" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12948"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12948/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12948">#12948</a>)<br>
🐞 fix(build): Remove React wildcard import to resolve ESM build issues
(<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3206776702" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12942"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12942/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12942">#12942</a>)<br>
🦭 chore: improve exclude patterns (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3202497669"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12935"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12935/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12935">#12935</a>)<br>
🐿️ chore: remove unused omit function (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3225961191" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12958"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12958/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12958">#12958</a>)</p>
<p>Big thanks to <a class="user-mention notranslate"
data-hovercard-type="user" data-hovercard-url="/users/joshkel/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/joshkel">@ joshkel</a> for helping
with some of the subscription bugs! and also <a class="user-mention
notranslate" data-hovercard-type="user"
data-hovercard-url="/users/kamja44/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/kamja44">@ kamja44</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/mrazauskas/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/mrazauskas">@ mrazauskas</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/codepunkt/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/codepunkt">@ codepunkt</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/afontcu/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/afontcu">@ afontcu</a> and <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/rururux/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/rururux">@ rururux</a></p>
      </li>
      <li>
<b>7.60.0</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.60.0">2025-07-04</a></br><p>🦘
feat: <code>reset</code> new <code>keepFieldsRef</code> options keep
fields reference (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3191330156"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12923"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12923/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12923">#12923</a>)</p>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="// This option will
skip input reference gets reset and avoid re-register input reference
after reset
reset(data, { keepFieldsRef: true })"><pre><span class="pl-c">// This
option will skip input reference gets reset and avoid re-register input
reference after reset</span>
<span class="pl-en">reset</span><span class="pl-kos">(</span><span
class="pl-s1">data</span><span class="pl-kos">,</span> <span
class="pl-kos">{</span> <span class="pl-c1">keepFieldsRef</span>: <span
class="pl-c1">true</span> <span class="pl-kos">}</span><span
class="pl-kos">)</span></pre></div>
      </li>
      <li>
<b>7.60.0-next.0</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.60.0-next.0">2025-07-01</a></br><p>🦘
feat: <code>reset</code> new <code>keepFieldsRef</code> options keep
fields reference (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3191330156"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12923"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12923/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12923">#12923</a>)</p>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="// This option will
skip input reference gets reset and avoid re-register input reference
after reset
reset(data, { keepFieldsRef: true })"><pre><span class="pl-c">// This
option will skip input reference gets reset and avoid re-register input
reference after reset</span>
<span class="pl-en">reset</span><span class="pl-kos">(</span><span
class="pl-s1">data</span><span class="pl-kos">,</span> <span
class="pl-kos">{</span> <span class="pl-c1">keepFieldsRef</span>: <span
class="pl-c1">true</span> <span class="pl-kos">}</span><span
class="pl-kos">)</span></pre></div>
      </li>
      <li>
<b>7.59.0</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.59.0">2025-06-28</a></br><p>🪱
feat: support deep equality checking with circular references (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3176586583" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12914"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12914/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12914">#12914</a>)<br>
🐞 fix <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="3162019046" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12900"
data-hovercard-type="issue"
data-hovercard-url="/react-hook-form/react-hook-form/issues/12900/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/issues/12900">#12900</a> issue
with formData reference clone (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3164608853"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12906"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12906/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12906">#12906</a>)<br>
🐞 fix <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="3124599969" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12873"
data-hovercard-type="issue"
data-hovercard-url="/react-hook-form/react-hook-form/issues/12873/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/issues/12873">#12873</a> issue
with undefined value for submit data (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3164563082" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12905"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12905/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12905">#12905</a>)<br>
🐞 fix case when useWatch accept object variable param (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3157299182" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12897"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12897/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12897">#12897</a>)<br>
🐞 fix: typo in UseFormSubscribe and missing event type for callback data
in subscribe (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3163748029"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12904"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12904/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12904">#12904</a>)<br>
Revert "⌨️ rename to UseFormResetFieldOptions for type consistency" (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3165853766" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12907"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12907/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12907">#12907</a>)</p>
<p>thanks to <a class="user-mention notranslate"
data-hovercard-type="user"
data-hovercard-url="/users/aspirisen/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/aspirisen">@ aspirisen</a> <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/n8pjl/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/n8pjl">@ n8pjl</a> <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/SKOLZ/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/SKOLZ">@ SKOLZ</a> <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/pushys/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/pushys">@ pushys</a> &amp; <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/candymask0712/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/candymask0712">@ candymask0712</a></p>
      </li>
      <li>
<b>7.58.1</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.58.1">2025-06-17</a></br><p>🔧
check window.crypto undefined (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3153410474"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12893"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12893/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12893">#12893</a>)</p>
      </li>
    </ul>
from <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases">react-hook-form
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI5YmFkOWQwOS0yOWQxLTQxMzAtOGQyZS01NWQyNGJkYzIxMTkiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjliYWQ5ZDA5LTI5ZDEtNDEzMC04ZDJlLTU1ZDI0YmRjMjExOSJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc/settings/integration?pkg&#x3D;react-hook-form&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"react-hook-form","from":"7.58.1","to":"7.61.0"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"9bad9d09-29d1-4130-8d2e-55d24bdc2119","prPublicId":"9bad9d09-29d1-4130-8d2e-55d24bdc2119","packageManager":"npm","priorityScoreList":[],"projectPublicId":"3a1ab099-8f8f-43a5-81e6-e07ff34c96dc","projectUrl":"https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":4,"publishedDate":"2025-07-23T23:20:49.867Z"},"vulns":[]}'

---------

Signed-off-by: Peter Jausovec <[email protected]>
Co-authored-by: snyk-bot <[email protected]>
peterj added a commit to kagent-dev/kagent that referenced this pull request Aug 17, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade react-hook-form from 7.61.0 to
7.61.1.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **1 version** ahead of your current
version.

- The recommended version was released **23 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>react-hook-form</b></summary>
    <ul>
      <li>
<b>7.61.1</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.61.1">2025-07-24</a></br><p>Revert
"⌨️ fix: watch return type based on defaultValue (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3156326445" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12896"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12896/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12896">#12896</a>)"</p>
      </li>
      <li>
<b>7.61.0</b> - <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases/tag/v7.61.0">2025-07-23</a></br><p>🧮
feat: compute prop for useWatch subscription (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2761362352" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12503"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12503/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12503">#12503</a>)</p>
<ul>
<li>subscribe to the entire form but only return updated value with
certain condition</li>
</ul>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="type FormValue = {
  test: string;
}

const watchedValue = useWatch({
  control: methods.control,
  compute: (data: FormValue) =&gt; {
    if (data.test?.length) {
      return data.test;
    }

    return '';
  },
});"><pre><span class="pl-k">type</span> <span
class="pl-smi">FormValue</span> <span class="pl-c1">=</span> <span
class="pl-kos">{</span>
<span class="pl-c1">test</span>: <span class="pl-smi">string</span><span
class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">const</span> <span class="pl-s1">watchedValue</span>
<span class="pl-c1">=</span> <span class="pl-en">useWatch</span><span
class="pl-kos">(</span><span class="pl-kos">{</span>
<span class="pl-c1">control</span>: <span
class="pl-s1">methods</span><span class="pl-kos">.</span><span
class="pl-c1">control</span><span class="pl-kos">,</span>
<span class="pl-en">compute</span>: <span class="pl-kos">(</span><span
class="pl-s1">data</span>: <span class="pl-smi">FormValue</span><span
class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span
class="pl-kos">{</span>
<span class="pl-k">if</span> <span class="pl-kos">(</span><span
class="pl-s1">data</span><span class="pl-kos">.</span><span
class="pl-c1">test</span><span class="pl-kos">?.</span><span
class="pl-c1">length</span><span class="pl-kos">)</span> <span
class="pl-kos">{</span>
<span class="pl-k">return</span> <span class="pl-s1">data</span><span
class="pl-kos">.</span><span class="pl-c1">test</span><span
class="pl-kos">;</span>
    <span class="pl-kos">}</span>

<span class="pl-k">return</span> <span class="pl-s">''</span><span
class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span
class="pl-kos">;</span></pre></div>
<ul>
<li>subscribe to a specific form value state</li>
</ul>
<div class="highlight highlight-source-tsx notranslate position-relative
overflow-auto" data-snippet-clipboard-copy-content="type FormValue = {
  test: string;
}

const watchedValue = useWatch({
  control: methods.control,
  name: 'test',
  compute: (data: string) =&gt; {
      return data.length &gt; 3 ? data : '';
  },
});"><pre><span class="pl-k">type</span> <span
class="pl-smi">FormValue</span> <span class="pl-c1">=</span> <span
class="pl-kos">{</span>
<span class="pl-c1">test</span>: <span class="pl-smi">string</span><span
class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">const</span> <span class="pl-s1">watchedValue</span>
<span class="pl-c1">=</span> <span class="pl-en">useWatch</span><span
class="pl-kos">(</span><span class="pl-kos">{</span>
<span class="pl-c1">control</span>: <span
class="pl-s1">methods</span><span class="pl-kos">.</span><span
class="pl-c1">control</span><span class="pl-kos">,</span>
<span class="pl-c1">name</span>: <span class="pl-s">'test'</span><span
class="pl-kos">,</span>
<span class="pl-en">compute</span>: <span class="pl-kos">(</span><span
class="pl-s1">data</span>: <span class="pl-smi">string</span><span
class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span
class="pl-kos">{</span>
<span class="pl-k">return</span> <span class="pl-s1">data</span><span
class="pl-kos">.</span><span class="pl-c1">length</span> <span
class="pl-c1">&gt;</span> <span class="pl-c1">3</span> ? <span
class="pl-s1">data</span> : <span class="pl-s">''</span><span
class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span
class="pl-kos">;</span></pre></div>
<p>👨‍🔧 trigger watch callbacks in response to value changes only (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3210030061" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12945"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12945/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12945">#12945</a>)<br>
🙏 track name with setValue subscription callbacks (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3210194804" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12946"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12946/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12946">#12946</a>)<br>
⌨️ fix: watch return type based on defaultValue (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3156326445" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12896"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12896/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12896">#12896</a>)<br>
🐞 fix <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="3226443079" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12959"
data-hovercard-type="issue"
data-hovercard-url="/react-hook-form/react-hook-form/issues/12959/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/issues/12959">#12959</a>
subscribe with latest defaultValues <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3226946310"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12961"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12961/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12961">#12961</a><br>
🐞 fix: handle explicit "multipart/form-data" encType in Form Component
(<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3212769870" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12948"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12948/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12948">#12948</a>)<br>
🐞 fix(build): Remove React wildcard import to resolve ESM build issues
(<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3206776702" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12942"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12942/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12942">#12942</a>)<br>
🦭 chore: improve exclude patterns (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3202497669"
data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12935"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12935/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12935">#12935</a>)<br>
🐿️ chore: remove unused omit function (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3225961191" data-permission-text="Title is private"
data-url="react-hook-form/react-hook-form#12958"
data-hovercard-type="pull_request"
data-hovercard-url="/react-hook-form/react-hook-form/pull/12958/hovercard"
href="https://redirect.github.com/react-hook-form/react-hook-form/pull/12958">#12958</a>)</p>
<p>Big thanks to <a class="user-mention notranslate"
data-hovercard-type="user" data-hovercard-url="/users/joshkel/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/joshkel">@ joshkel</a> for helping
with some of the subscription bugs! and also <a class="user-mention
notranslate" data-hovercard-type="user"
data-hovercard-url="/users/kamja44/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/kamja44">@ kamja44</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/mrazauskas/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/mrazauskas">@ mrazauskas</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/codepunkt/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/codepunkt">@ codepunkt</a>, <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/afontcu/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/afontcu">@ afontcu</a> and <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/rururux/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/rururux">@ rururux</a></p>
      </li>
    </ul>
from <a
href="https://redirect.github.com/react-hook-form/react-hook-form/releases">react-hook-form
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJjMTY2MTdjMi0yNDBkLTRkZDItOTRiZC01ZjZhOGI1MjY1OGQiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImMxNjYxN2MyLTI0MGQtNGRkMi05NGJkLTVmNmE4YjUyNjU4ZCJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc/settings/integration?pkg&#x3D;react-hook-form&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"react-hook-form","from":"7.61.0","to":"7.61.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"c16617c2-240d-4dd2-94bd-5f6a8b52658d","prPublicId":"c16617c2-240d-4dd2-94bd-5f6a8b52658d","packageManager":"npm","priorityScoreList":[],"projectPublicId":"3a1ab099-8f8f-43a5-81e6-e07ff34c96dc","projectUrl":"https://app.snyk.io/org/kagent/project/3a1ab099-8f8f-43a5-81e6-e07ff34c96dc?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-07-24T12:22:03.373Z"},"vulns":[]}'

Co-authored-by: snyk-bot <[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