Skip to content
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

[8.10] [Logs] Amend lazy imports in logs_shared plugin (#164102) #164180

Merged
merged 1 commit into from
Aug 17, 2023

Commits on Aug 17, 2023

  1. [Logs] Amend lazy imports in logs_shared plugin (elastic#164102)

    ## Summary
    
    As part of elastic#161151 a [selection of
    component imports were made
    lazy](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/public/index.ts#L52)
    and wrapped with a [`dynamic` wrapper
    component](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/common/dynamic.tsx#L22).
    Unfortunately some of these imports did not adhere to the rules of
    React's `lazy` imports (needing a `default` export, no named imports
    etc), and the `dynamic` wrapper seems to have suppressed error
    information that would have been available via using `lazy` directly.
    
    Only the anomaly and categories log entry examples (in the expanded
    rows) were affected by this, as the stream and embeddable import from
    locations that were backed by a `default` export (and those top level
    components don't import from that particular index file lower in the
    hierarchy). For imports that weren't backed by a `default` I've added
    them, and where necessary moved components to new files if needed (since
    it's one `default` per file).
    
    Also open to suggestions of ways we can alter the `<dynamic />`
    component and maintain the error safety 🤔
    
    ## Examples
    
    Without these changes:
    
    ![Screenshot 2023-08-16 at 17 35
    50](https://github.com/elastic/kibana/assets/471693/78aa0300-109e-40b5-b64f-6574a547cbf3)
    
    Warning using `lazy` directly without the `dynamic` wrapper:
    
    ![Screenshot 2023-08-16 at 17 36
    27](https://github.com/elastic/kibana/assets/471693/a71e3c72-cf3a-4846-9ee9-df70c1729b03)
    
    ## Testing
    
    - Check all instances render correctly (stream, embeddable uses, and ML
    page log entry examples).
    
    (cherry picked from commit a96785c)
    Kerry350 committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    513cca8 View commit details
    Browse the repository at this point in the history