Skip to content

Commit

Permalink
Merge pull request #6541 from surveyjs/bug/nextjs-applystyle-error
Browse files Browse the repository at this point in the history
NextJS check on settings.environment in applyTheme
  • Loading branch information
andrewtelnov authored Jul 17, 2023
2 parents e2948fc + cff6f6c commit 8adcc88
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/stylesmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export class StylesManager {
return themeMapper;
}
static getIncludedThemeCss(): Array<any> {
if (typeof settings.environment === "undefined") return [];
const { rootElement }: ISurveyEnvironment = settings.environment;
const themeMapper = StylesManager.getAvailableThemes();

Expand Down Expand Up @@ -324,6 +325,7 @@ export class StylesManager {
}

public static applyTheme(themeName: string = "default", themeSelector?: string): void {
if (typeof settings.environment === "undefined") return;
const { rootElement }: ISurveyEnvironment = settings.environment;
const element = isShadowDOM(rootElement) ? rootElement.host : rootElement;
surveyCss.currentType = themeName;
Expand Down

0 comments on commit 8adcc88

Please sign in to comment.