Skip to content

Comments

fix: fixed scroll issue while configuring workflow#23142

Merged
anikdhabal merged 1 commit intocalcom:mainfrom
ShashwatPS:shashwatps/scroll_issue_workflow
Aug 19, 2025
Merged

fix: fixed scroll issue while configuring workflow#23142
anikdhabal merged 1 commit intocalcom:mainfrom
ShashwatPS:shashwatps/scroll_issue_workflow

Conversation

@ShashwatPS
Copy link
Contributor

@ShashwatPS ShashwatPS commented Aug 17, 2025

What does this PR do?

Video Demo:

Before Fix

https://www.loom.com/share/8e93e6b2ecc440ab91abc3f6840ca778?sid=9791328e-2245-4db1-836c-c9cf3d41823c

After Fix

https://www.loom.com/share/480473716d384d009b403974c52cbd6f?sid=25685ee0-153c-47c4-b324-69a7122cfb39

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?

  • No environment variables needed just running it locally works.
  • The seeded data during dev start suffice.

Files Modified

packages/features/ee/workflows/pages/workflow.tsx

Approach

After the initial data for the configuration page has been fetched, I added a pending state that tracks this in the useEffect dependency array. This runs a callback function to scroll to the top inside a requestAnimationFrame, ensuring the scroll happens after the DOM has loaded.

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked that my changes generate no new warnings

@vercel
Copy link

vercel bot commented Aug 17, 2025

@ShashwatPS is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Aug 17, 2025

CLA assistant check
All committers have signed the CLA.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Aug 17, 2025
@graphite-app graphite-app bot requested a review from a team August 17, 2025 17:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Walkthrough

A useEffect hook was added to packages/features/ee/workflows/pages/workflow.tsx. It computes an isPending flag (from isPendingWorkflow or isPendingEventTypes) and, on changes to this flag, schedules a requestAnimationFrame that calls window.scrollTo({ top: 0, behavior: "smooth" }). No exported/public API signatures changed. No other logic or control flow was modified.

Assessment against linked issues

Objective Addressed Explanation
Ensure the workflow creation page starts at the top on load and is not scrolled partway down (#23141, CAL-6267)

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added workflows area: workflows, automations 🐛 bug Something isn't working labels Aug 17, 2025
@github-actions
Copy link
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Fixed scroll issue while configuring workflow". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@ShashwatPS ShashwatPS changed the title Fixed scroll issue while configuring workflow fix: fixed scroll issue while configuring workflow Aug 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/features/ee/workflows/pages/workflow.tsx (2)

112-120: Guard the scroll to run only after data has finished loading; add cleanup and reduced-motion respect

As written, this fires on every toggle of isPending (including when it becomes true) and doesn’t cancel a queued rAF on unmount. Also, respect users who prefer reduced motion.

Apply this diff:

-  useEffect(() => {
-    requestAnimationFrame(() => {
-      window.scrollTo({
-        top: 0,
-        behavior: "smooth",
-      });
-    });
-  }, [isPending]);
+  useEffect(() => {
+    // Only scroll when loading has finished
+    if (isPending) return;
+    const prefersReducedMotion =
+      typeof window !== "undefined" &&
+      "matchMedia" in window &&
+      window.matchMedia("(prefers-reduced-motion: reduce)").matches;
+    const rafId = requestAnimationFrame(() => {
+      window.scrollTo({
+        top: 0,
+        behavior: prefersReducedMotion ? "auto" : "smooth",
+      });
+    });
+    return () => cancelAnimationFrame(rafId);
+  }, [isPending]);

112-120: Avoid unexpected top-of-page jumps after later refetches (e.g., post-save) by gating to initial load only

After updates, invalidate() will refetch and flip isPending again, causing another scroll-to-top. If the intent is “only on first load,” gate with a ref.

Please verify: after saving a workflow (which invalidates queries), does the page jump back to top? If yes, consider this adjustment:

Add a ref (outside this block):

// augment the existing import:
// import { useEffect, useState } from "react";
import { useEffect, useState, useRef } from "react";

// inside component:
const hasScrolledOnInitialLoadRef = useRef(false);

Then adapt the effect:

useEffect(() => {
  if (isPending || hasScrolledOnInitialLoadRef.current) return;
  const rafId = requestAnimationFrame(() => {
    window.scrollTo({ top: 0, behavior: "smooth" });
    hasScrolledOnInitialLoadRef.current = true;
  });
  return () => cancelAnimationFrame(rafId);
}, [isPending]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 469a942 and 8f82f5a.

📒 Files selected for processing (1)
  • packages/features/ee/workflows/pages/workflow.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/features/ee/workflows/pages/workflow.tsx
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/ee/workflows/pages/workflow.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Install dependencies / Yarn install & cache
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
packages/features/ee/workflows/pages/workflow.tsx (1)

112-120: Approach looks good (rAF + scroll after data fetch)

Using requestAnimationFrame ensures scrolling happens post-paint, which is appropriate for this UI glitch. Nice, small, targeted fix.

@graphite-app
Copy link

graphite-app bot commented Aug 17, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/17/25)

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

"Add community label" took an action on this PR • (08/17/25)

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

"Add ready-for-e2e label" took an action on this PR • (08/18/25)

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

Copy link
Contributor

@Devanshusharma2005 Devanshusharma2005 left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

E2E results are ready!

@anikdhabal anikdhabal merged commit 511be73 into calcom:main Aug 19, 2025
75 of 83 checks passed
@ShashwatPS ShashwatPS deleted the shashwatps/scroll_issue_workflow branch August 21, 2025 10:07
@coderabbitai coderabbitai bot mentioned this pull request Sep 8, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync ready-for-e2e workflows area: workflows, automations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scroll bug while configuring workflows locally

4 participants