fix(dev): infinite get-session calls#1039
Conversation
v0.3.20: KB Tag fixes
…ypes (#919) * feat(execution-filesystem): system to pass files between blocks (#866) * feat(files): pass files between blocks * presigned URL for downloads * Remove latest migration before merge * starter block file upload wasn't getting logged * checkpoint in human readable form * checkpoint files / file type outputs * file downloads working for block outputs * checkpoint file download * fix type issues * remove filereference interface with simpler user file interface * show files in the tag dropdown for start block * more migration to simple url object, reduce presigned time to 5 min * Remove migration 0065_parallel_nightmare and related files - Deleted apps/sim/db/migrations/0065_parallel_nightmare.sql - Deleted apps/sim/db/migrations/meta/0065_snapshot.json - Removed 0065 entry from apps/sim/db/migrations/meta/_journal.json Preparing for merge with origin/staging and migration regeneration * add migration files * fix tests * Update apps/sim/lib/uploads/setup.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/sim/lib/workflows/execution-file-storage.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/sim/lib/workflows/execution-file-storage.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * cleanup types * fix lint * fix logs typing for file refs * open download in new tab * fixed * Update apps/sim/tools/index.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * fix file block * cleanup unused code * fix bugs * remove hacky file id logic * fix drag and drop * fix tests --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * feat(trigger-mode): added trigger-mode to workflow_blocks table (#902) * fix(schedules-perms): use regular perm system to view/edit schedule info (#901) * fix(schedules-perms): use regular perm system to view schedule info * fix perms * improve logging * feat(webhooks): deprecate singular webhook block + add trigger mode to blocks (#903) * feat(triggers): added new trigger mode for blocks, added socket event, ran migrations * Rename old trigger/ directory to background/ * cleaned up, ensured that we display active webhook at the block-level * fix submenu in tag dropdown * keyboard nav on tag dropdown submenu * feat(triggers): add outlook to new triggers system * cleanup * add types to tag dropdown, type all outputs for tools and use that over block outputs * update doc generator to truly reflect outputs * fix docs * add trigger handler * fix active webhook tag * tag dropdown fix for triggers * remove trigger mode schema change * feat(execution-filesystem): system to pass files between blocks (#866) * feat(files): pass files between blocks * presigned URL for downloads * Remove latest migration before merge * starter block file upload wasn't getting logged * checkpoint in human readable form * checkpoint files / file type outputs * file downloads working for block outputs * checkpoint file download * fix type issues * remove filereference interface with simpler user file interface * show files in the tag dropdown for start block * more migration to simple url object, reduce presigned time to 5 min * Remove migration 0065_parallel_nightmare and related files - Deleted apps/sim/db/migrations/0065_parallel_nightmare.sql - Deleted apps/sim/db/migrations/meta/0065_snapshot.json - Removed 0065 entry from apps/sim/db/migrations/meta/_journal.json Preparing for merge with origin/staging and migration regeneration * add migration files * fix tests * Update apps/sim/lib/uploads/setup.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/sim/lib/workflows/execution-file-storage.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update apps/sim/lib/workflows/execution-file-storage.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * cleanup types * fix lint * fix logs typing for file refs * open download in new tab * fixed * Update apps/sim/tools/index.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * fix file block * cleanup unused code * fix bugs * remove hacky file id logic * fix drag and drop * fix tests --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * feat(trigger-mode): added trigger-mode to workflow_blocks table (#902) * fix(schedules-perms): use regular perm system to view/edit schedule info (#901) * fix(schedules-perms): use regular perm system to view schedule info * fix perms * improve logging * cleanup * prevent tooltip showing up on modal open * updated trigger config * fix type issues --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> * fix(helm): fix helm charts migrations using wrong image (#907) * fix(helm): fix helm charts migrations using wrong image * fixed migrations * feat(whitelist): add email & domain-based whitelisting for signups (#908) * improvement(helm): fix duplicate SOCKET_SERVER_URL and add additional envvars to template (#909) * improvement(helm): fix duplicate SOCKET_SERVER_URL and add additional envvars to template * rm serper & freestyle * improvement(tag-dropdown): typed tag dropdown values (#910) * fix(min-chunk): remove minsize for chunk (#911) * fix(min-chunk): remove minsize for chunk * fix tests * improvement(chunk-config): migrate unused default for consistency (#913) * fix(mailer): update mailer to use the EMAIL_DOMAIN (#914) * fix(mailer): update mailer to use the EMAIL_DOMAIn * add more * Improvement(cc): added cc to gmail and outlook (#900) * changed just gmail * bun run lint * fixed bcc * updated docs --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: waleedlatif1 <walif6@gmail.com> * fix(email-validation): add email validation to prevent bouncing, fixed OTP validation (#916) * feat(email-validation): add email validation to prevent bouncing * removed suspicious patterns * fix(verification): fixed OTP verification * fix failing tests, cleanup * fix(otp): fix email not sending (#917) * fix(email): manual OTP instead of better-auth (#921) * fix(email): manual OTP instead of better-auth * lint --------- Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
…ers fixes v0.3.23: multiplayer variables, api key fixes, kb improvements, triggers fixes
v0.3.24: revert redis session management change
v0.3.25: oauth credentials sharing mechanism, workflow block error handling changes
…curity improvements v0.3.26: fix billing, bubble up workflow block errors, credentials security improvements
v0.3.27: oauth/webhook fixes, whitelabel fixes, code cleanups
attempt to fix build issues (#985)
v0.3.29: copilot fixes, remove block from subflow, code cleanups
fix: migration mem issues bypass
syntax issue in migration
reduce batch size to prevent timeouts
update migration file for notekeeping purpose
…s fixes, UI/UX improvements
* get user workflow * get env vars and oauth creds * metadtata * Search docs * More tools * Build edit workflow * Read workflwo console * v1 * UPdates * Fixes * Updates * Skip tools * Lint * Fix tests * Remove logs * Remove more logs * UPdate
…ws (#1032) * improvement(console): increase console max entries for larger workflows * increase safety limit for infinite loops
* Add rate limits * Lint
…operations (#1035) * improvement(supabase): added more verbose error logging for supabase operations * updated docs
…nd other subblocks + gdrive fixes (#1029) * fix(oauth-block): race condition for rendering credential selectors and other subblocks * fix import * add dependsOn field to track cros-subblock deps * remove redundant check * remove redundant checks * remove misleading comment * fix * fix jira * fix * fix * confluence * fix triggers * fix * fix * make trigger creds collab supported * fix for backwards compat * fix trigger modal
* Fixes * Updates * Build workflow names * Refactor icons * Lint * Update build tool name
There was a problem hiding this comment.
Greptile Summary
This PR addresses infinite session calls during hot module reloading (HMR) in development by implementing two key changes:
-
Singleton Better Auth Client Pattern: The auth client now uses a development-only singleton pattern that stores the client instance on
globalThisto prevent multiple client instances from being created during HMR cycles. ThegetOrCreateClient()function checks for an existing client in development mode and reuses it, only creating new instances when necessary. -
Centralized Session Management: Session fetching has been moved from individual components to the workspace layout level. A new
WorkspaceSessionContextprovides session data to all child components through React context, eliminating redundantuseSession()calls throughout the component tree.
The changes affect multiple components across the workspace, including the sidebar, control bar, settings modals, and various management components. All components now use useWorkspaceSession() instead of directly calling useSession(), accessing user data through the centralized context. This architectural shift maintains identical functionality while significantly improving development performance by ensuring only one session fetch occurs per workspace load.
The implementation follows React best practices by lifting session state up to avoid prop drilling while providing controlled access to authentication data. The singleton pattern is conditionally applied only in development environments, ensuring production behavior remains unchanged.
Confidence score: 3/5
- This PR addresses a legitimate development issue but introduces type safety concerns with multiple
anyassertions - Score reflects the use of type assertions to bypass TypeScript restrictions and potential runtime issues if globalThis behavior differs across environments
- Pay close attention to auth-client.ts for the type assertions and workspace/layout.tsx for the session context implementation
Context used:
Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)
10 files reviewed, 2 comments
There was a problem hiding this comment.
Greptile Summary
This review covers only the changes made since the last review (commit d46d2c2), not the entire PR.
The most recent changes focus on cleaning up the authentication implementation by addressing the type assertion issue identified in the previous review. The key change is the removal of the image field from the SessionUser interface and user object construction in the workspace layout. This eliminates the problematic type assertion to any that was previously used to access the image property from the session data.
Additionally, minor improvements were made to the login form by adding explicit type annotations to the error handling callback in the email sign-in function. The onError callback now has proper TypeScript types for the error context, improving type safety and developer experience.
These changes complement the existing singleton Better Auth client implementation and workspace-level session management that were addressed in the previous review, creating a more robust and type-safe authentication system.
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it removes problematic code and improves type safety
- Score reflects the elimination of type assertions to
anyand addition of proper TypeScript typing - No files require special attention as the changes are straightforward type safety improvements
Context used:
Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)
4 files reviewed, no comments
…, new supabase tools
…nite-get-session-hmr
Summary
Get session at workspace level and pass it to components.
Type of Change
Testing
Manually
Checklist