fix(notion): improve trigger polling logic and resolve database loadi…#28480
Open
dev-frog wants to merge 1 commit inton8n-io:masterfrom
Open
fix(notion): improve trigger polling logic and resolve database loadi…#28480dev-frog wants to merge 1 commit inton8n-io:masterfrom
dev-frog wants to merge 1 commit inton8n-io:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant UI as Editor UI
participant Trigger as Notion Trigger Node
participant GF as Generic Functions
participant Store as Static Data Store
participant Notion as Notion API
Note over UI, Notion: UI Loading Flow (Fixes "can't get data" error)
UI->>Trigger: Request Load Options (e.g., getDatabases)
Trigger->>GF: notionApiRequestAllItems()
GF->>GF: NEW: Safe-fetch 'resource' parameter (defaults undefined)
GF->>Notion: Request metadata/resources
Notion-->>UI: Return list for dropdown
Note over UI, Notion: Polling Execution (Fixes Duplicate Logic)
Trigger->>Store: Get lastTimeChecked & possibleDuplicates
Trigger->>Notion: Query DB (timestamp >= lastTimeChecked)
Notion-->>Trigger: Return records (Minute-level precision)
Trigger->>Trigger: Filter out IDs present in possibleDuplicates
alt NEW: Current records fall within same minute as last poll
Trigger->>Trigger: NEW: Append new IDs to possibleDuplicates list
else NEW: Most recent record is a new minute window
Trigger->>Trigger: NEW: Replace possibleDuplicates with new IDs
end
Trigger->>Store: CHANGED: Persist lastTimeChecked as ISO String (only on success)
Trigger-->>UI: Output unique records to workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ng error #28463
Summary
This PR fixes two major issues with the Notion Trigger:
getDatabasesload option by making theresourceparameter optional innotionApiRequestAllItems.Changes
lastTimeCheckedfrom a Moment object to an ISO String for reliable persistence instaticData.possibleDuplicateslogic to track IDs within the same minute window, preventing re-processing of items Notion returns during high-frequency polling.notionApiRequestAllItemsinGenericFunctions.tsto prevent crashes when called from triggers/load-options where a specific resource context is missing.Testing
Related Issues
Fixes #28463
Internal Ref: GHC-7732