Skip to content

Fix HMR for Client Dependency Packages#1612

Merged
johbaxter merged 2 commits intodevfrom
fix-client-dev-script
Jul 30, 2025
Merged

Fix HMR for Client Dependency Packages#1612
johbaxter merged 2 commits intodevfrom
fix-client-dev-script

Conversation

@j-adam-connor
Copy link
Copy Markdown
Contributor

Description

This pull request fixes an issue requiring packages to be individually built in order to show changes made within. For example, the platform team has been working within libs/renderer, and has been unable to view changes to their code without navigating to the renderer package and running the build script. This was especially problematic because they were reporting build times exceeding 7 minutes.

This pull request ensures that turbo build:dev is run on all dependency packages of the package running turbo run dev. This ensures that when the client's Vite dev server starts, all the libraries it imports (UI components, renderer, SDK) are already built and available in their dist folders, and thus enables HMR for all dependent packages once the initial dev script has completed.

Changes Made

  • Added dependsOn: ["^build:dev"] to dev script in turbo.json

How to Test

  1. Start client dev environment by running pnpm run dev:client from the root (SemossWeb/semoss-ui depending on your path configuration).
  2. Wait for all packages to build. (Note: renderer takes several minutes to build.)
  3. Open app and make a change in a dependency package's code.
  4. Verify that changes are reflected in the app with HMR.

Notes

  • Initial build time is still quite long, as renderer takes exceedingly long to complete--as mentioned above, near 8 minutes on some machines. The dev scripts can be optimized with caching and running the builds concurrently as well. I will address this in a subsequent PR, as I want to keep the scope of this PR focused since it affects a large number of users and addresses a critical issue.
  • There is still an existing issue with the dev script where there is a conflict between the client and playground. Basically, playground ends up superseding the client startup, so running pnpm run dev will result in the playground running on port 5174 and the client not running at all. I'll propose this change in a subsequent PR as well.

@j-adam-connor j-adam-connor requested a review from a team as a code owner July 30, 2025 19:55
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /describe

@QodoAI-Agent
Copy link
Copy Markdown

Title

Fix HMR for Client Dependency Packages


User description

Description

This pull request fixes an issue requiring packages to be individually built in order to show changes made within. For example, the platform team has been working within libs/renderer, and has been unable to view changes to their code without navigating to the renderer package and running the build script. This was especially problematic because they were reporting build times exceeding 7 minutes.

This pull request ensures that turbo build:dev is run on all dependency packages of the package running turbo run dev. This ensures that when the client's Vite dev server starts, all the libraries it imports (UI components, renderer, SDK) are already built and available in their dist folders, and thus enables HMR for all dependent packages once the initial dev script has completed.

Changes Made

  • Added dependsOn: ["^build:dev"] to dev script in turbo.json

How to Test

  1. Start client dev environment by running pnpm run dev:client from the root (SemossWeb/semoss-ui depending on your path configuration).
  2. Wait for all packages to build. (Note: renderer takes several minutes to build.)
  3. Open app and make a change in a dependency package's code.
  4. Verify that changes are reflected in the app with HMR.

Notes

  • Initial build time is still quite long, as renderer takes exceedingly long to complete--as mentioned above, near 8 minutes on some machines. The dev scripts can be optimized with caching and running the builds concurrently as well. I will address this in a subsequent PR, as I want to keep the scope of this PR focused since it affects a large number of users and addresses a critical issue.
  • There is still an existing issue with the dev script where there is a conflict between the client and playground. Basically, playground ends up superseding the client startup, so running pnpm run dev will result in the playground running on port 5174 and the client not running at all. I'll propose this change in a subsequent PR as well.

PR Type

Bug fix


Description

  • Add dependsOn: ["^build:dev"] to dev task

  • Ensure all packages build before running dev

  • Minor formatting fix in package.json


Diagram Walkthrough

flowchart LR
  dev["turbo run dev (dev task)"]
  builddev["build:dev task"]
  deps["Dependency packages"]
  dev -- "dependsOn" --> builddev
  builddev -- "^build:dev" --> deps
Loading

File Walkthrough

Relevant files
Formatting
package.json
Format `prepare` script spacing                                                   

package.json

  • Added space after colon in prepare script
  • Standardized script formatting
+1/-1     
Configuration changes
turbo.json
Add dev dependency on build:dev                                                   

turbo.json

  • Introduced dependsOn: ["^build:dev"] for dev
  • Ensures libraries build before dev server
  • Retained existing task configurations
+37/-36 

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /review

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /improve

@QodoAI-Agent
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Prepare Script

Ensure lefthook is listed as a dependency and that adding the prepare script does not introduce unexpected install hooks or conflicts.

"prepare": "lefthook install",
Dependency Build Scope

Verify that adding dependsOn: ["^build:dev"] for the dev task correctly triggers builds for all dependent packages without causing circular build loops.

"dev": {
	"dependsOn": ["^build:dev"],
	"inputs": ["$TURBO_DEFAULT$", ".env*"],
	"cache": false,
	"persistent": true
},

@QodoAI-Agent
Copy link
Copy Markdown

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
General
Use consistent space indentation

Replace tab-based indentation with spaces to maintain consistent formatting and
avoid potential parsing or linting issues in JSON files. Align this block with the
rest of your configuration using two spaces per indent level.

turbo.json [24-29]

 "dev": {
-    "dependsOn": ["^build:dev"],
-    "inputs": ["$TURBO_DEFAULT$", ".env*"],
-    "cache": false,
-    "persistent": true
+  "dependsOn": ["^build:dev"],
+  "inputs": ["$TURBO_DEFAULT$", ".env*"],
+  "cache": false,
+  "persistent": true
 },
Suggestion importance[1-10]: 4

__

Why: The change replaces tabs with two-space indents to match the existing JSON style and prevent linting issues.

Low

Copy link
Copy Markdown
Contributor

@johbaxter johbaxter left a comment

Choose a reason for hiding this comment

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

One liner, my guy ty

@johbaxter johbaxter merged commit 77749ec into dev Jul 30, 2025
3 checks passed
@johbaxter johbaxter deleted the fix-client-dev-script branch July 30, 2025 21:21
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /update_changelog

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.

3 participants