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

chore: Upgrade React #32288

Merged
merged 10 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use React root
  • Loading branch information
tassoevan committed Jan 28, 2025
commit 17def2195e56d600f39441ec85617c86102ab014
4 changes: 3 additions & 1 deletion apps/meteor/client/components/UserStatusMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ const UserStatusMenu = ({
[hide, reset],
);

useEffect(() => onChange(status), [status, onChange]);
useEffect(() => {
onChange(status);
}, [status, onChange]);

return (
<>
Expand Down
10 changes: 6 additions & 4 deletions apps/meteor/client/lib/createReactiveSubscriptionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ export const createReactiveSubscriptionFactory =

let computation: Tracker.Computation | undefined;

queueMicrotask(() => {
computation = Tracker.autorun(reactiveFn);
});

return [
(callback): (() => void) => {
callbacks.add(callback);

queueMicrotask(() => {
if (!computation || computation.stopped) {
computation = Tracker.autorun(reactiveFn);
}
});

return (): void => {
callbacks.delete(callback);

Expand Down
7 changes: 4 additions & 3 deletions apps/meteor/client/startup/appRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StrictMode } from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import AppRoot from '../views/root/AppRoot';

Expand All @@ -17,9 +17,10 @@ const createContainer = (): Element => {

const container = createContainer();

render(
const root = createRoot(container);

root.render(
<StrictMode>
<AppRoot />
</StrictMode>,
container,
);
4 changes: 4 additions & 0 deletions packages/ui-client/src/helpers/anchors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const setAnchorRefCount = (anchorElement: HTMLElement, refCount: number): void =

export const refAnchorElement = (anchorElement: HTMLElement): void => {
setAnchorRefCount(anchorElement, getAnchorRefCount(anchorElement) + 1);

if (anchorElement.parentElement !== document.body) {
document.body.appendChild(anchorElement);
}
};

export const unrefAnchorElement = (anchorElement: HTMLElement): void => {
Expand Down