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

fix: removed plain chat from app.cal.com/video #18385

Merged
merged 8 commits into from
Dec 27, 2024
Merged

Conversation

nizzyabi
Copy link
Contributor

@nizzyabi nizzyabi commented Dec 27, 2024

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Make sure to add:
NEXT_PUBLIC_PLAIN_CHAT_EXCLUDED_PATHS="/video"

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Copy link

vercel bot commented Dec 27, 2024

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Dec 27, 2024 5:39pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Dec 27, 2024 5:39pm

@graphite-app graphite-app bot requested a review from a team December 27, 2024 14:05
Copy link

graphite-app bot commented Dec 27, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (12/27/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (12/27/24)

1 label was added to this PR based on Keith Williams's automation.

@keithwillcode keithwillcode added the core area: core, team members only label Dec 27, 2024
@dosubot dosubot bot added the 🐛 bug Something isn't working label Dec 27, 2024
@Udit-takkar Udit-takkar added this to the v4.9 milestone Dec 27, 2024
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

Changes looks fine. could you DM me the plain.com .env vars to test it locally?

@nizzyabi
Copy link
Contributor Author

Changes looks fine. could you DM me the plain.com .env vars to test it locally?

sent!!

PeerRich
PeerRich previously approved these changes Dec 27, 2024
Copy link
Contributor

github-actions bot commented Dec 27, 2024

E2E results are ready!

Comment on lines 73 to 74
if (typeof window === "undefined") return null;

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't use this

Copy link
Contributor

Choose a reason for hiding this comment

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

React docs mention that 🔴 Do not call Hooks after a conditional return statement here https://react.dev/warnings/invalid-hook-call-warning

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yes hooks should be first, this should be below L79

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

This issue could lead to errors/warning #18385 (comment) because React uses a call stack to associate each hook invocation with its corresponding component instance. If a hook is skipped because a conditional return is encountered, React's internal bookkeeping becomes mismatched, causing errors.

@github-actions github-actions bot added the ❗️ .env changes contains changes to env variables label Dec 27, 2024
@github-actions github-actions bot marked this pull request as draft December 27, 2024 16:18
@nizzyabi
Copy link
Contributor Author

okay, should i use a react usestate instead or put it somewhere else?

@nizzyabi
Copy link
Contributor Author

nizzyabi commented Dec 27, 2024

something like this @Udit-takkar ? const isAppDomain = typeof window !== "undefined" && window.location.origin === process.env.NEXT_PUBLIC_WEBAPP_URL && !restrictedPaths.some((path) => pathname?.startsWith(path.trim()));

Udit-takkar
Udit-takkar previously approved these changes Dec 27, 2024
apps/web/lib/plain/plainChat.tsx Outdated Show resolved Hide resolved
@github-actions github-actions bot marked this pull request as draft December 27, 2024 17:37
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

gtg

@emrysal emrysal marked this pull request as ready for review December 27, 2024 17:42
@emrysal emrysal enabled auto-merge (squash) December 27, 2024 17:42
@emrysal emrysal merged commit a27e149 into main Dec 27, 2024
38 checks passed
@emrysal emrysal deleted the plain-chat-hotfix branch December 27, 2024 18:42
joeauyeung pushed a commit that referenced this pull request Jan 5, 2025
* fix: removed plain chat from app.cal.com/video

* take user session and open plain out of use effect

* move undefined check and screen size check above useeffect

* turned restrcited paths into env var

* undefeined window below hooks

* chore: add window check

* fix: infinite re rendering

* remove console.log

---------

Co-authored-by: Udit Takkar <[email protected]>
MuhammadAimanSulaiman pushed a commit to hit-pay/cal.com that referenced this pull request Jan 10, 2025
* fix: removed plain chat from app.cal.com/video

* take user session and open plain out of use effect

* move undefined check and screen size check above useeffect

* turned restrcited paths into env var

* undefeined window below hooks

* chore: add window check

* fix: infinite re rendering

* remove console.log

---------

Co-authored-by: Udit Takkar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working core area: core, team members only ❗️ .env changes contains changes to env variables ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants