Skip to content

Route-Scoping / Cleanup function #162

@therealPaulPlay

Description

@therealPaulPlay

Describe the feature in detail (code, mocks, or screenshots encouraged)

Currently, ModeWatcher fires once when mounted and stays active. Unmounting it doesn't disable it.

When designing a site that should only partially adjust to the theme, that is problematic.

For example:

  • Landing page is always light mode
  • Dashboard adjusts to the user's preference

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

Making it so that unmounting actually cleans it up and ensuring colorScheme and the "dark" class are removed would be elegant. Or, providing a function to clean up mode-watcher.

Using setMode or resetMode when is destroyed would not work in this scenario because they would overwrite the user's preference for the /dashboard.

Problem example:

  • User opens /landing-page, it appears white (correct)
  • User navigates to /dashboard which includes the component, it appears dark since that's the user's preference (correct)
  • User navigates back to /landing-page, which now appears in dark mode since unmounting doesn't clean it up (incorrect)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions