Skip to content

NbLayoutDirectionService: Cannot read properties of null (reading 'setAttribute') #3308

@wnabil

Description

@wnabil

NbLayoutDirectionService throws error on second direction change.
The error doesn't appear when changing the direction for the first time

ERROR TypeError: Cannot read properties of null (reading 'setAttribute')
    at OverlayRef._updateElementDirection (overlay-module-6629f4c6.mjs:1171:16)
    at OverlayRef.setDirection (overlay-module-6629f4c6.mjs:1133:10)
    at Object.next (nebular-theme.mjs:4169:74)
    at ConsumerObserver2.next (Subscriber.js:90:25)
    at Subscriber2._next (Subscriber.js:59:22)
    at Subscriber2.next (Subscriber.js:32:12)
    at Subject.js:41:22
    at errorContext (errorContext.js:23:5)
    at Subject2.next (Subject.js:31:5)
    at Object.next (share.js:57:25)

@nebular/theme: 15.0.0

  setAppLanguage() {
    const language =
      this.currentUserProfile?.preferred_langcode ||
      navigator.language.split('-')[0] ||
      'en';
    this.translateService.use(language);

    const direction =
      language === 'en' ? NbLayoutDirection.LTR : NbLayoutDirection.RTL;
    this.layoutDirectionService.setDirection(direction);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions