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

rethrow errors thrown during effectFn and cleanup #33

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

dmaskasky
Copy link
Member

@dmaskasky dmaskasky commented Feb 29, 2024

Errors thrown in the effect function are getting swallowed. I'm not sure exactly where they are getting swallowed but it might have something to do with the effect function running in the next microtask or perhaps something to do with React suspense.

This PR addresses this issue by saving the error to the ref object and then forcing a recalculation of the effectFn. The error is rethrown and the error is picked up by the ErrorBoundary.

Related Issue: #32

Copy link

codesandbox-ci bot commented Feb 29, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@dmaskasky dmaskasky changed the title rethrow errors thrown during effecFn and cleanup rethrow errors thrown during effectFn and cleanup Feb 29, 2024
@dmaskasky dmaskasky merged commit 749066b into main Feb 29, 2024
3 checks passed
Brooooooklyn referenced this pull request in toeverything/AFFiNE Mar 5, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3) ([source](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3)) | [`3.523.0` -> `3.525.0`](https://renovatebot.com/diffs/npm/@aws-sdk%2fclient-s3/3.523.0/3.525.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@aws-sdk%2fclient-s3/3.525.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@aws-sdk%2fclient-s3/3.525.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@aws-sdk%2fclient-s3/3.523.0/3.525.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@aws-sdk%2fclient-s3/3.523.0/3.525.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@node-rs/jsonwebtoken](https://github.com/napi-rs/node-rs) | [`^0.4.0` -> `^0.5.0`](https://renovatebot.com/diffs/npm/@node-rs%2fjsonwebtoken/0.4.0/0.5.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@node-rs%2fjsonwebtoken/0.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@node-rs%2fjsonwebtoken/0.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@node-rs%2fjsonwebtoken/0.4.0/0.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@node-rs%2fjsonwebtoken/0.4.0/0.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@nx/vite](https://nx.dev) ([source](https://github.com/nrwl/nx/tree/HEAD/packages/vite)) | [`18.0.5` -> `18.0.7`](https://renovatebot.com/diffs/npm/@nx%2fvite/18.0.5/18.0.7) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@nx%2fvite/18.0.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nx%2fvite/18.0.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nx%2fvite/18.0.5/18.0.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nx%2fvite/18.0.5/18.0.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/exporter-prometheus](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus) ([source](https://github.com/open-telemetry/opentelemetry-js)) | [`^0.48.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fexporter-prometheus/0.48.0/0.49.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fexporter-prometheus/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fexporter-prometheus/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fexporter-prometheus/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fexporter-prometheus/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation) ([source](https://github.com/open-telemetry/opentelemetry-js)) | [`^0.48.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation/0.48.0/0.49.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http) ([source](https://github.com/open-telemetry/opentelemetry-js)) | [`^0.48.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-http/0.48.0/0.49.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2finstrumentation-http/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2finstrumentation-http/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2finstrumentation-http/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2finstrumentation-http/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@opentelemetry/sdk-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node) ([source](https://github.com/open-telemetry/opentelemetry-js)) | [`^0.48.0` -> `^0.49.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2fsdk-node/0.48.0/0.49.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@opentelemetry%2fsdk-node/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@opentelemetry%2fsdk-node/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@opentelemetry%2fsdk-node/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@opentelemetry%2fsdk-node/0.48.0/0.49.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [jotai-effect](https://github.com/jotaijs/jotai-effect) | [`^0.5.0` -> `^0.6.0`](https://renovatebot.com/diffs/npm/jotai-effect/0.5.0/0.6.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/jotai-effect/0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/jotai-effect/0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/jotai-effect/0.5.0/0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/jotai-effect/0.5.0/0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [yarn](https://github.com/yarnpkg/berry) ([source](https://github.com/yarnpkg/berry/tree/HEAD/packages/yarnpkg-cli)) | [`4.1.0` -> `4.1.1`](https://renovatebot.com/diffs/npm/yarn/4.1.0/4.1.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/yarn/4.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/yarn/4.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/yarn/4.1.0/4.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/yarn/4.1.0/4.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>aws/aws-sdk-js-v3 (@&#8203;aws-sdk/client-s3)</summary>

### [`v3.525.0`](https://github.com/aws/aws-sdk-js-v3/blob/HEAD/clients/client-s3/CHANGELOG.md#35250-2024-02-29)

[Compare Source](https://github.com/aws/aws-sdk-js-v3/compare/v3.523.0...v3.525.0)

**Note:** Version bump only for package [@&#8203;aws-sdk/client-s3](https://github.com/aws-sdk/client-s3)

</details>

<details>
<summary>napi-rs/node-rs (@&#8203;node-rs/jsonwebtoken)</summary>

### [`v0.5.1`](https://github.com/napi-rs/node-rs/releases/tag/%40node-rs/jsonwebtoken%400.5.1)

[Compare Source](https://github.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.5.0...@node-rs/jsonwebtoken@0.5.1)

#### What's Changed

-   chore(deps): lock file maintenance by [@&#8203;renovate](https://github.com/renovate) in [https://github.com/napi-rs/node-rs/pull/800](https://github.com/napi-rs/node-rs/pull/800)
-   fix(jsonwebtoken): handle error in decodeHeader by [@&#8203;Brooooooklyn](https://github.com/Brooooooklyn) in [https://github.com/napi-rs/node-rs/pull/801](https://github.com/napi-rs/node-rs/pull/801)

**Full Changelog**: https://github.com/napi-rs/node-rs/compare/[@&#8203;node-rs/crc32](https://github.com/node-rs/crc32)[@&#8203;1](https://github.com/1).10.0...[@&#8203;node-rs/jsonwebtoken](https://github.com/node-rs/jsonwebtoken)[@&#8203;0](https://github.com/0).5.1

### [`v0.5.0`](https://github.com/napi-rs/node-rs/releases/tag/%40node-rs/jsonwebtoken%400.5.0)

[Compare Source](https://github.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.4.0...@node-rs/jsonwebtoken@0.5.0)

#### What's Changed

-   fix(jsonwebtoken): num typings by [@&#8203;tada5hi](https://github.com/tada5hi) in [https://github.com/napi-rs/node-rs/pull/777](https://github.com/napi-rs/node-rs/pull/777)
-   feat(jsonwebtoken): flatten claims to align with rfc by [@&#8203;tada5hi](https://github.com/tada5hi) in [https://github.com/napi-rs/node-rs/pull/780](https://github.com/napi-rs/node-rs/pull/780)
-   feat(jsonwebtoken): expose decode header utility by [@&#8203;tada5hi](https://github.com/tada5hi) in [https://github.com/napi-rs/node-rs/pull/795](https://github.com/napi-rs/node-rs/pull/795)
-   chore(\*): upgrade NAPI-RS cli and bindings by [@&#8203;Brooooooklyn](https://github.com/Brooooooklyn) in [https://github.com/napi-rs/node-rs/pull/797](https://github.com/napi-rs/node-rs/pull/797)
-   feat(jsonwebtoken): support wasm32-wasi target by [@&#8203;Brooooooklyn](https://github.com/Brooooooklyn) in [https://github.com/napi-rs/node-rs/pull/798](https://github.com/napi-rs/node-rs/pull/798)

#### New Contributors

-   [@&#8203;tada5hi](https://github.com/tada5hi) made their first contribution in [https://github.com/napi-rs/node-rs/pull/777](https://github.com/napi-rs/node-rs/pull/777)

**Full Changelog**: https://github.com/napi-rs/node-rs/compare/[@&#8203;node-rs/argon2](https://github.com/node-rs/argon2)[@&#8203;1](https://github.com/1).7.0...[@&#8203;node-rs/jsonwebtoken](https://github.com/node-rs/jsonwebtoken)[@&#8203;0](https://github.com/0).5.0

</details>

<details>
<summary>nrwl/nx (@&#8203;nx/vite)</summary>

### [`v18.0.7`](https://github.com/nrwl/nx/releases/tag/18.0.7)

[Compare Source](https://github.com/nrwl/nx/compare/18.0.6...18.0.7)

#### 18.0.7 (2024-03-04)

##### 🩹 Fixes

-   **core:** target defaults should represent nx.json in source info ([#&#8203;22080](https://github.com/nrwl/nx/pull/22080))
-   **nextjs:** Add spec files when creating a next app ([#&#8203;22079](https://github.com/nrwl/nx/pull/22079))
-   **release:** skip lock file update if workspaces are not enabled ([#&#8203;22055](https://github.com/nrwl/nx/pull/22055))
-   **remix:** ensure component-testing is exported correctly [#&#8203;22091](https://github.com/nrwl/nx/issues/22091) ([#&#8203;22095](https://github.com/nrwl/nx/pull/22095), [#&#8203;22091](https://github.com/nrwl/nx/issues/22091))
-   **storybook:** handle main.js file correctly in storybook plugin ([#&#8203;22081](https://github.com/nrwl/nx/pull/22081))
-   **testing:** calculate correct support file path in cypress e2e preset ([#&#8203;22096](https://github.com/nrwl/nx/pull/22096))

##### ❤️  Thank You

-   Austin Fahsl [@&#8203;fahslaj](https://github.com/fahslaj)
-   Colum Ferry [@&#8203;Coly010](https://github.com/Coly010)
-   Craigory Coppola [@&#8203;AgentEnder](https://github.com/AgentEnder)
-   Leosvel Pérez Espinosa [@&#8203;leosvelperez](https://github.com/leosvelperez)
-   Nicholas Cunningham [@&#8203;ndcunningham](https://github.com/ndcunningham)

### [`v18.0.6`](https://github.com/nrwl/nx/releases/tag/18.0.6)

[Compare Source](https://github.com/nrwl/nx/compare/18.0.5...18.0.6)

##### 18.0.6 (2024-02-29)

##### 🩹 Fixes

-   **core:** nextjs-standalone generates package scripts consistent with create-next-app ([#&#8203;21996](https://github.com/nrwl/nx/pull/21996))
-   **misc:** make sure to add e2e crystal plugin ([#&#8203;22041](https://github.com/nrwl/nx/pull/22041))
-   **misc:** fix buildable libs utils calculating dependent projects from task graph ([#&#8203;22015](https://github.com/nrwl/nx/pull/22015))
-   **node:** Increase timeout for CI ([#&#8203;22003](https://github.com/nrwl/nx/pull/22003))
-   **nuxt:** fix storybook preview config path ([#&#8203;22020](https://github.com/nrwl/nx/pull/22020))
-   **nuxt:** Add e2e-ci and serve-static targets ([#&#8203;22056](https://github.com/nrwl/nx/pull/22056))
-   **release:** currentVersionResolver git-tag should prefer merged tags ([#&#8203;22082](https://github.com/nrwl/nx/pull/22082))

##### ❤️  Thank You

-   Austin Fahsl [@&#8203;fahslaj](https://github.com/fahslaj)
-   Jack Hsu [@&#8203;jaysoo](https://github.com/jaysoo)
-   Katerina Skroumpelou [@&#8203;mandarini](https://github.com/mandarini)
-   Leosvel Pérez Espinosa [@&#8203;leosvelperez](https://github.com/leosvelperez)
-   Nicholas Cunningham [@&#8203;ndcunningham](https://github.com/ndcunningham)

</details>

<details>
<summary>open-telemetry/opentelemetry-js (@&#8203;opentelemetry/exporter-prometheus)</summary>

### [`v0.49.1`](https://github.com/open-telemetry/opentelemetry-js/compare/7be35c7845e206b27b682e8ce1cee850b09cec04...3920b158d08daa776280bde68a79e44bafa4e8ea)

[Compare Source](https://github.com/open-telemetry/opentelemetry-js/compare/7be35c7845e206b27b682e8ce1cee850b09cec04...3920b158d08daa776280bde68a79e44bafa4e8ea)

### [`v0.49.0`](https://github.com/open-telemetry/opentelemetry-js/compare/828f2ed730e4d26d71f92e220f96b60a552a673a...7be35c7845e206b27b682e8ce1cee850b09cec04)

[Compare Source](https://github.com/open-telemetry/opentelemetry-js/compare/828f2ed730e4d26d71f92e220f96b60a552a673a...7be35c7845e206b27b682e8ce1cee850b09cec04)

</details>

<details>
<summary>jotaijs/jotai-effect (jotai-effect)</summary>

### [`v0.6.0`](https://github.com/jotaijs/jotai-effect/releases/tag/v0.6.0)

[Compare Source](https://github.com/jotaijs/jotai-effect/compare/v0.5.0...v0.6.0)

#### What's Changed

-   rethrow errors thrown during effectFn and cleanup by [@&#8203;dmaskasky](https://github.com/dmaskasky) in [https://github.com/jotaijs/jotai-effect/pull/33](https://github.com/jotaijs/jotai-effect/pull/33)

**Full Changelog**: jotaijs/jotai-effect@v0.5.0...v0.6.0

</details>

<details>
<summary>yarnpkg/berry (yarn)</summary>

### [`v4.1.1`](https://github.com/yarnpkg/berry/compare/52909a5e0d2fe72245957870bcd654218d93ef72...6b7621f0736ef7ed423672392882d68592d61c81)

[Compare Source](https://github.com/yarnpkg/berry/compare/52909a5e0d2fe72245957870bcd654218d93ef72...6b7621f0736ef7ed423672392882d68592d61c81)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjAuMiIsInVwZGF0ZWRJblZlciI6IjM3LjIyMC4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
@dmaskasky dmaskasky deleted the effect-error branch April 6, 2024 21:44
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.

1 participant