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: notifications #273

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

feat: notifications #273

wants to merge 35 commits into from

Conversation

RobPruzan
Copy link
Collaborator

@RobPruzan RobPruzan commented Feb 25, 2025

Release: /~https://github.com/aidenybai/react-scan/releases/tag/v0.2.0

Why is this PR not merged into main yet?

Main contains issues that we didn't have time to patch. We hope to have this branch in main very soon. In the meantime all new work should branch of "precise" until this is completed

Copy link

vercel bot commented Feb 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-scan ❌ Failed (Inspect) Feb 27, 2025 9:06pm

@@ -7,7 +7,7 @@
},
"css.lint.unknownAtRules": "ignore",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
"editor.defaultFormatter": "esbenp.prettier-vscode"
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh boy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't worry i turned linting off entirely :)

Copy link

pkg-pr-new bot commented Feb 25, 2025

Open in Stackblitz

npm i https://pkg.pr.new/aidenybai/react-scan@273

commit: d3f7098

};
handleResizeListener = handleResize;

window.addEventListener("resize", handleResize);
Copy link
Collaborator

Choose a reason for hiding this comment

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

no debounce/throttle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do

const isUsedInBrowserExtension = typeof window !== 'undefined';
initReactScanInstrumentation({
onActive: () => {
const rdtHook = getRDTHook();
Copy link
Collaborator

@lxsmnsyc lxsmnsyc Feb 25, 2025

Choose a reason for hiding this comment

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

if my assumption here is correct (I haven't seen the implementation), this might not be compatible with React 18 sync SSR (not Remix-based since they cheat). Basically, the issue is that React 18 SSR is strict with the markup during hydration so any tampering would cause it throw error (in our case, inserting the toolbar and the canvas). React 19 doesn't have this issue thanks to the new SSR architecture.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This also throws an error for the CLI since the auto script runs before the document exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do u know how we solved this on current main?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@RobPruzan

const scheduleSetup = () => {
if (mounted) {
return;
}
if (schedule) {
clearTimeout(schedule);
}
schedule = requestAnimationFrame(() => {
mounted = true;
const host = getCanvasEl();
if (host) {
document.documentElement.appendChild(host);
}
setupToolbar();
}); // TODO(Alexis): perhaps a better timing
};

debounce until no commit is done to the fiber tree, which is basically two birds hit with one stone.

) => {
toolbarEventStore.getState().actions.addEvent({
kind: "interaction",
id: crypto.randomUUID(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

future fix: needs compat check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops missed this, should use the generateId fn we have

const isProduction: boolean = process.env.NODE_ENV === "production";
const prefix: string = "Invariant failed";

// FIX ME THIS IS PRODUCTION INVARIANT LOL
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's fine, I do this as well LOL

skipBoundaries: true,
};

const FILTER_PATTERNS = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

realistically this may not be 100% (nor 50%) accurate, unless this is intentional, of course.

Copy link
Collaborator Author

@RobPruzan RobPruzan Feb 25, 2025

Choose a reason for hiding this comment

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

oh yeah that was from monitoring a while ago. I think i had o1 think for a while and create a ton of test cases that filtered bad components, and that was the implementation that passed the most cases. Not really necessary to do this for notifications

@popover.tsx Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

empty file ;)

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