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

INSTUI-4322 Make it possible to not use global theme registry. Deprecate global theme registry. #1762

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

matyasf
Copy link
Collaborator

@matyasf matyasf commented Nov 6, 2024

The main goal of this PR is to make it possible to run InstUI v8/v9 in the same page as InstUI v10 when the host app uses the older version and a later initialized one v10.
Currently this causes the v10 app to look buggy because ThemeRegistry will return an incompatible v8 theme object:

in canvas.ts:

const theme = ThemeRegistry.registerTheme(__theme)
export default theme

in ThemeRegistry.registerTheme:

if (theme.key && registry.themes[theme.key]) {
    return registry.themes[theme.key] as RegisteredTheme<T>
  }

This PR makes it possible to get the theme directly circumventing ThemeRegistry and its theme cache. Also deprecates ThemeRegistry (which is used for global themes)

@matyasf matyasf self-assigned this Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-11-22 12:41 UTC

@matyasf matyasf force-pushed the deprecate_globalthis branch from 4d59415 to 7aab574 Compare November 11, 2024 13:13
@matyasf matyasf changed the title WIP: Have a way to circumvent the global theme registry Make it possible to not use global theme registry. Deprecate global theme registry. Nov 11, 2024
@@ -69,3 +74,4 @@ const __theme: CanvasTheme = {
const theme = ThemeRegistry.registerTheme(__theme)

export default theme
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change and what we will recommend people to use

@matyasf matyasf requested review from HerrTopi and balzss November 11, 2024 16:45
@matyasf matyasf changed the title Make it possible to not use global theme registry. Deprecate global theme registry. INSTUI-4322 Make it possible to not use global theme registry. Deprecate global theme registry. Nov 13, 2024
@matyasf matyasf merged commit 3e109be into master Nov 22, 2024
12 checks passed
@matyasf matyasf deleted the deprecate_globalthis branch November 22, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants