Skip to content

[system] initColorSchemeScript.tsx uses var instead of let #43418

@oliviertassinari

Description

@oliviertassinari

Summary

We use var:

var mode = localStorage.getItem('${modeStorageKey}') || 'system';

but this seems confusing. Why not let? For example, https://github.com/pacocoursey/next-themes/blob/bf0c5a45eaf6fb2b336a6b93840e4ec572bc08c8/next-themes/src/script.ts#L14 who use modern syntax.

Using let over var seems to have two benefits:

Motivation

I was confused by this looking into #43416.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowTo delay as much as possible.ready to takeHelp wanted. Guidance available. There is a high chance the change will be acceptedscope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions