-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: Create a async execute trigger flow #39009
Conversation
WalkthroughThis PR implements several type safety improvements and introduces new asynchronous functionalities across the codebase. In the sagas, the return type for Changes
Sequence Diagram(s)sequenceDiagram
participant W as Widget
participant D as UNSTABLE_executeDynamicTrigger
participant RU as GracefulWorkerService.request
participant Worker as Worker Thread
W->>D: Trigger dynamic execution
D->>RU: Call request(method, data)
RU->>Worker: Send request with evaluation payload
Worker-->>RU: Return response & telemetry
RU-->>D: Provide response
D-->>W: Resolve promise with result
sequenceDiagram
participant A as Action Dispatcher
participant ES as evaluateActionSelectorFieldSaga
participant EW as evalWorker
A->>ES: Dispatch action with payload (id, type, value)
ES->>EW: Evaluate expression in `value`
EW-->>ES: Return evaluation result and lint errors
ES->>ES: Dispatch update with the evaluated result
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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)
app/client/src/utils/WorkerUtil.ts (1)
249-346
: LGTM! Comprehensive worker request implementation with telemetry.The implementation includes:
- Proper error handling
- Performance tracking
- Resource cleanup
However, consider adding a timeout mechanism for requests.
Consider adding a timeout parameter with a default value:
-*request(method: string, data = {}): any { +*request(method: string, data = {}, timeoutMs = 30000): any { yield this.ready(true); + const timeoutChannel = channel(); + setTimeout(() => { + timeoutChannel.put(new Error('Request timeout')); + timeoutChannel.close(); + }, timeoutMs);🧰 Tools
🪛 Biome (1.9.4)
[error] 332-333: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
app/client/src/sagas/EvaluationsSaga.ts (1)
891-937
: Consider improving error handling and typing in the new saga.The saga implementation could benefit from:
- Stronger typing for the action parameter instead of
any
- More structured error handling with specific error types
Consider this improvement:
-export function* evaluateActionSelectorFieldSaga(action: any) { +interface ActionSelectorFieldPayload { + id: string; + type: string; + value: string; +} + +export function* evaluateActionSelectorFieldSaga( + action: ReduxAction<ActionSelectorFieldPayload> +) {- } catch (e) { + } catch (e: unknown) { + const error = e as Error; log.error(e); - Sentry.captureException(e); + Sentry.captureException(error); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
app/client/src/ce/sagas/ActionExecution/ActionExecutionSagas.ts
(1 hunks)app/client/src/constants/AppsmithActionConstants/ActionConstants.tsx
(2 hunks)app/client/src/sagas/EvaluationsSaga.ts
(2 hunks)app/client/src/utils/WorkerUtil.ts
(1 hunks)app/client/src/workers/Evaluation/asyncWorkerActions.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: perform-test / client-build / client-build
- GitHub Check: perform-test / server-build / server-unit-tests
- GitHub Check: perform-test / rts-build / build
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-build / client-build
🔇 Additional comments (5)
app/client/src/workers/Evaluation/asyncWorkerActions.ts (1)
8-27
: LGTM! Well-structured async function implementation.The function is properly marked as unstable and follows a clear flow for trigger execution.
Since this is marked as unstable, verify all usages to ensure proper error handling:
✅ Verification successful
Final Verification:
The shell script output confirms that the only reference toUNSTABLE_executeDynamicTrigger
is its own definition. No external usages were found, so the error handling viarunSaga
appears to be appropriately scoped.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for all usages of the unstable function rg "UNSTABLE_executeDynamicTrigger"Length of output: 170
app/client/src/ce/sagas/ActionExecution/ActionExecutionSagas.ts (1)
142-142
: Type safety improvement: Changed return type from any to Generator.Good improvement in type safety by explicitly declaring the Generator return type.
app/client/src/constants/AppsmithActionConstants/ActionConstants.tsx (2)
30-33
: LGTM! Clear enum definition for trigger kinds.The enum values are well-defined and self-documenting.
38-38
: Type safety improvement: Changed Array to Array.Good improvement in type safety by using unknown instead of any.
app/client/src/sagas/EvaluationsSaga.ts (1)
344-344
: Great type safety improvement!Replacing
Array<any>
withArray<unknown>
enhances type safety by requiring explicit type checking.
Description
Creates the promise flow for executing a trigger by converting it from a saga to an async function
This is still unstable and should not be used unless you know what you are doing
Fixes #38941
Automation
/ok-to-test tags="@tag.Sanity"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13132868310
Commit: e3a7b33
Cypress dashboard.
Tags:
@tag.Sanity
Spec:
Tue, 04 Feb 2025 10:38:35 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Refactor