Skip to content

Instantly share code, notes, and snippets.

@ferrata
Created July 24, 2024 02:58
Show Gist options
  • Save ferrata/8bee77409195338ecc14eb15ab352407 to your computer and use it in GitHub Desktop.
Save ferrata/8bee77409195338ecc14eb15ab352407 to your computer and use it in GitHub Desktop.
sequenceDiagram
    participant User
    participant Builder
    participant Database
    participant Host

    User->>Builder: Get iframe URL (usePreviewUrl)
    Builder->>Database: Get pageId from URL
    Database-->>Builder: pageId
    Builder->>Database: Fetch pathname of the page
    Database-->>Builder: Pathname
    Builder->>Host: Fetch host manifest
    Host-->>Builder: Manifest
    Builder->>Builder: Determine preview URL based on manifest

    alt Localized Page
        Builder->>Database: Check if localized page exists
        Database-->>Builder: Localized page not created
        Builder->>Database: Create localized page
        Database-->>Builder: Localized page created
    end

    Builder->>User: Open iframe (PreviewFrame)
    Builder->>Host: Set ready to true, send makeswift_draft_mode
    Host->>Host: Patch fetch to include draft mode in headers
    Host-->>Builder: Subsequent requests in draft mode
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment