Skip to content

Only check functions called on first paint #159

Open
@gracebrack

Description

@gracebrack

@lwc/lwc/no-unsupported-ssr-properties and @lwc/lwc/no-restricted-browser-globals-during-ssr check all functions in a component for unsafe SSR practices. However, not all functions need to be SSR safe, only those called on first paint.

Example:

export default class ExampleButton {
    handleFocus() {
        this.dispatchEvent(new CustomEvent('focus')); //@lwc/lwc/no-unsupported-ssr-properties error
        console.log(window.location.href) //@lwc/lwc/no-restricted-browser-globals-during-ssr error
    }
}

Screenshot 2024-07-15 at 3 28 41 PM

Relevant Slack Thread: https://salesforce-internal.slack.com/archives/C5W3E40TC/p1719415297404469

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions