Skip to content

Commit e3c5e05

Browse files
chore(deps-dev): bump the internal-tooling group with 5 updates (#1416)
* chore(deps-dev): bump the internal-tooling group with 5 updates Bumps the internal-tooling group with 5 updates: | Package | From | To | | --- | --- | --- | | [@inrupt/base-rollup-config](https://github.com/inrupt/typescript-sdk-tools) | `4.0.5` | `4.0.8` | | [@inrupt/eslint-config-base](https://github.com/inrupt/typescript-sdk-tools) | `4.0.5` | `4.0.8` | | [@inrupt/internal-playwright-helpers](https://github.com/inrupt/typescript-sdk-tools) | `4.0.5` | `4.0.8` | | [@inrupt/internal-test-env](https://github.com/inrupt/typescript-sdk-tools) | `4.0.5` | `4.0.8` | | [@inrupt/jest-jsdom-polyfills](https://github.com/inrupt/typescript-sdk-tools) | `4.0.5` | `4.0.8` | Updates `@inrupt/base-rollup-config` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/inrupt/typescript-sdk-tools/releases) - [Commits](inrupt/typescript-sdk-tools@v4.0.5...v4.0.8) Updates `@inrupt/eslint-config-base` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/inrupt/typescript-sdk-tools/releases) - [Commits](inrupt/typescript-sdk-tools@v4.0.5...v4.0.8) Updates `@inrupt/internal-playwright-helpers` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/inrupt/typescript-sdk-tools/releases) - [Commits](inrupt/typescript-sdk-tools@v4.0.5...v4.0.8) Updates `@inrupt/internal-test-env` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/inrupt/typescript-sdk-tools/releases) - [Commits](inrupt/typescript-sdk-tools@v4.0.5...v4.0.8) Updates `@inrupt/jest-jsdom-polyfills` from 4.0.5 to 4.0.8 - [Release notes](https://github.com/inrupt/typescript-sdk-tools/releases) - [Commits](inrupt/typescript-sdk-tools@v4.0.5...v4.0.8) --- updated-dependencies: - dependency-name: "@inrupt/base-rollup-config" dependency-version: 4.0.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: internal-tooling - dependency-name: "@inrupt/eslint-config-base" dependency-version: 4.0.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: internal-tooling - dependency-name: "@inrupt/internal-playwright-helpers" dependency-version: 4.0.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: internal-tooling - dependency-name: "@inrupt/internal-test-env" dependency-version: 4.0.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: internal-tooling - dependency-name: "@inrupt/jest-jsdom-polyfills" dependency-version: 4.0.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: internal-tooling ... Signed-off-by: dependabot[bot] <[email protected]> * Lint --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicolas Ayral Seydoux <[email protected]>
1 parent 9b66395 commit e3c5e05

File tree

2 files changed

+265
-182
lines changed

2 files changed

+265
-182
lines changed

e2e/browser/test-app/components/notifications/index.tsx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,36 @@ export default function Notifications() {
216216

217217
useEffect(() => {
218218
if (parentContainerUrl !== undefined && socket === undefined) {
219-
setSocket(
220-
new WebsocketNotification(parentContainerUrl, {
221-
fetch: session.fetch,
222-
}),
223-
);
219+
// Setting the state should not be done synchronously in the useEffect hook.
220+
// The async change will trigger another call to the hook when the state has
221+
// been update.
222+
new Promise(() => {
223+
setSocket(
224+
new WebsocketNotification(parentContainerUrl, {
225+
fetch: session.fetch,
226+
}),
227+
);
228+
}).catch((e) => {
229+
console.error(`An error happened opening the socket: ${e}`);
230+
});
224231
}
225232
if (socket !== undefined) {
226-
setConnectionStatus("closed");
227-
socket.on("connected", () => setConnectionStatus("connected"));
228-
socket.on("closed", () => {
233+
new Promise(() => {
229234
setConnectionStatus("closed");
230-
setMessageBus([]);
231-
});
232-
socket.on("error", () => setConnectionStatus("error"));
233-
socket.on("message", (message) => {
234-
setMessageBus((previousMessageBus) => [message, ...previousMessageBus]);
235+
socket.on("connected", () => setConnectionStatus("connected"));
236+
socket.on("closed", () => {
237+
setConnectionStatus("closed");
238+
setMessageBus([]);
239+
});
240+
socket.on("error", () => setConnectionStatus("error"));
241+
socket.on("message", (message) => {
242+
setMessageBus((previousMessageBus) => [
243+
message,
244+
...previousMessageBus,
245+
]);
246+
});
247+
}).catch((e) => {
248+
console.error(`An error happened setting the callbacks: ${e}`);
235249
});
236250
}
237251
}, [socket, parentContainerUrl]);

0 commit comments

Comments
 (0)