Skip to content

fix(components): scroll strategy tokens throw NullInjectorError outside their NgModule (#DS-3522) - #1888

Open
lskramarov wants to merge 2 commits into
mainfrom
fix/DS-3522
Open

fix(components): scroll strategy tokens throw NullInjectorError outside their NgModule (#DS-3522)#1888
lskramarov wants to merge 2 commits into
mainfrom
fix/DS-3522

Conversation

@lskramarov

Copy link
Copy Markdown
Contributor

No description provided.

@lskramarov lskramarov self-assigned this Aug 13, 2026
Copilot AI lite review requested due to automatic review settings August 13, 2026 06:51
@lskramarov lskramarov added the bug Something isn't working label Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes NullInjectorError cases that occur when Koobiq components are consumed outside their legacy NgModule injector (e.g., as bare standalone imports, via other standalone components, or inside modal content created from the root environment injector). It does so by making multiple scroll-strategy InjectionTokens self-sufficient via providedIn: 'root' factories, and by improving missing-date-provider diagnostics for datepicker/time-range.

Changes:

  • Move various *_SCROLL_STRATEGY tokens to providedIn: 'root' defaults and remove redundant NgModule-level factory providers.
  • Improve missing DateAdapter / DateFormatter diagnostics via a shared datepicker injection helper and stricter runtime checks.
  • Add regression tests for standalone consumption and for datepicker-in-modal behavior; update docs explaining injector behavior in modals.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/components/tree-select/tree-select.module.ts Removes module-level select scroll strategy provider now that the token has a root default.
packages/components/tooltip/tooltip.module.ts Drops module-level tooltip scroll strategy provider; keeps open-time provider wiring.
packages/components/tooltip/tooltip.component.ts Makes KBQ_TOOLTIP_SCROLL_STRATEGY self-provided via providedIn: 'root' factory.
packages/components/title/title.directive.spec.ts Removes now-unnecessary tooltip scroll strategy provider from tests.
packages/components/timezone/timezone-select.component.spec.ts Adds a regression suite verifying standalone consumption works without KbqSelectModule.
packages/components/time-range/time-range.service.ts Improves missing provider error diagnostics for DateAdapter/DateFormatter.
packages/components/select/select.module.ts Removes module-level select scroll strategy provider now that the token has a root default.
packages/components/select/select.component.spec.ts Adds regression tests ensuring standalone select works and explicit token overrides win.
packages/components/popover/popover.module.ts Drops module-level popover scroll strategy provider.
packages/components/popover/popover.component.ts Makes KBQ_POPOVER_SCROLL_STRATEGY self-provided via providedIn: 'root' factory.
packages/components/notification-center/notification-center.ts Makes notification-center scroll strategy token self-provided via providedIn: 'root' factory.
packages/components/notification-center/notification-center.module.ts Drops module-level notification-center scroll strategy provider.
packages/components/modal/examples.modal.ru.md Updates RU docs clarifying modal injector behavior and how to pass the caller injector.
packages/components/modal/examples.modal.en.md Updates EN docs clarifying modal injector behavior and how to pass the caller injector.
packages/components/dropdown/dropdown.module.ts Drops module-level dropdown scroll strategy provider.
packages/components/dropdown/dropdown-trigger.directive.ts Makes KBQ_DROPDOWN_SCROLL_STRATEGY self-provided via providedIn: 'root' factory.
packages/components/datepicker/month-view.component.ts Switches to shared injectRequiredDateAdapter helper for clearer missing-provider errors.
packages/components/datepicker/datepicker.component.ts Makes datepicker scroll strategy token self-provided; uses required-date-adapter helper.
packages/components/datepicker/datepicker-module.ts Drops module-level datepicker scroll strategy provider; retains intl provider.
packages/components/datepicker/datepicker-input.directive.ts Switches to shared injectRequiredDateAdapter helper and removes redundant constructor guard.
packages/components/datepicker/datepicker-in-modal.spec.ts Adds regression test for datepicker usage inside modal content created from root injector.
packages/components/datepicker/datepicker-errors.ts Introduces injectRequiredDateAdapter helper to throw a clearer error than NullInjectorError.
packages/components/datepicker/calendar.component.ts Switches to shared injectRequiredDateAdapter helper and removes redundant constructor guard.
packages/components/datepicker/calendar-header.spec.ts Adds test verifying the missing DateAdapter error message is explicit.
packages/components/datepicker/calendar-header.component.ts Uses injectRequiredDateAdapter instead of direct DI.
packages/components/core/select/constants.ts Makes KBQ_SELECT_SCROLL_STRATEGY self-provided via providedIn: 'root' factory.
packages/components/button-toggle/button-toggle.module.ts Updates module comment now that standalone imports no longer require module-provided tooltip scroll strategy.
packages/components/autocomplete/autocomplete.module.ts Drops module-level autocomplete scroll strategy provider.
packages/components/autocomplete/autocomplete-trigger.directive.ts Makes KBQ_AUTOCOMPLETE_SCROLL_STRATEGY self-provided via providedIn: 'root' factory.
apps/docs/src/assets/stackblitz/src/main.ts Removes unnecessary tooltip scroll strategy provider from StackBlitz bootstrap providers.
apps/docs/src/app/services/i18n.characterization.spec.ts Removes unnecessary tooltip scroll strategy provider from docs test setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit c8969fd):

https://koobiq-next--prs-1888-dsisspod.web.app

(expires Sun, 16 Aug 2026 07:14:48 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c

…le (#DS-3522)

Extracting injectRequiredDateAdapter() dropped the explicit DateAdapter
import from datepicker-input and month-view. The inferred type is the same,
but api-extractor then renders the two public adapter fields as
_koobiq_components_core.DateAdapter<D> instead of DateAdapter<D>, which
fails check-api on an otherwise unchanged public surface.

Annotate both fields explicitly so the report is byte-identical again.
provideHttpClient(),
provideRouter([]),
{ provide: KBQ_LOCALE_SERVICE, useClass: KbqLocaleService },
KBQ_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER

@artembelik artembelik Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

в прошлый раз мы это добавили, тк тултипы на стакблитз не отображались DS-5007

UPD. стакблитз запускается, ошибок нет

}
}

describe('datepicker inside a modal', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Достаточно ли просто добавить в datepicker.spec.ts, чтобы не создавать новый файл?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants