Skip to content

Conversation

@riccardoperra
Copy link
Collaborator

@riccardoperra riccardoperra commented Jan 18, 2026

The following PR will update flexRenderComponent helper in order to pass bindings and directivesoptions into the viewContainerRef.createComponent call.

Angular 20 has introduced those new options to set inputs in a more convenient way. It also allows to set directives at component creation time.

https://angular.dev/guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation

Summary by CodeRabbit

  • New Features
    • Support configuring native Angular bindings and directives when creating dynamic components.
  • Changes
    • Directive is no longer standalone — it must be declared in a module.
  • Tests
    • Added tests covering input/output binding scenarios for dynamic components; removed one legacy assertion about mandatory options.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 18, 2026

⚠️ No Changeset found

Latest commit: 78ee0ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Adds creation-time Angular bindings and directives support to flex-render: new type aliases and interfaces, a FlexRenderComponentInstance wrapper exposing bindings/directives, factory propagation into createComponent, instanceof adjustment, directive decorator change, and tests exercising input/output bindings.

Changes

Cohort / File(s) Summary
Core flex-render API
packages/angular-table/src/flex-render/flexRenderComponent.ts
Added type aliases (CreateComponentOptions, CreateComponentBindings, CreateComponentDirectives); FlexRenderOptions now accepts bindings/directives; FlexRenderComponent interface gains bindings/directives; exported class renamed to FlexRenderComponentInstance with constructor accepting directives and bindings; flexRenderComponent returns the new instance.
Factory & view integration
packages/angular-table/src/flex-render/flexRenderComponentFactory.ts, packages/angular-table/src/flex-render/view.ts
Factory forwards directives and bindings into createComponent options (bindings default to []); view.ts runtime type check updated to instanceof FlexRenderComponentInstance.
Directive & exports
packages/angular-table/src/flexRender.ts, packages/angular-table/src/index.ts
Removed standalone: true from @Directive on FlexRenderDirective; index.ts changed from named export to export * of the flex-render component module.
Tests
packages/angular-table/tests/flex-render/flex-render-component.test-d.ts, packages/angular-table/tests/flex-render/flex-render-table.test.ts
Removed a type-check test; added runtime test "Support cell with component input/output binding" using Angular inputBinding/outputBinding to exercise creation-time bindings and verify input/output wiring.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant flexRenderComponent
  participant Factory
  participant AngularCreateComponent
  participant RenderedComponent

  Caller->>flexRenderComponent: request component config (component, bindings, directives, injector)
  flexRenderComponent->>Factory: map config -> create options (injector, directives, bindings)
  Factory->>AngularCreateComponent: createComponent(options)
  AngularCreateComponent->>RenderedComponent: instantiate with directives/bindings applied
  RenderedComponent-->>Caller: mounted instance (via FlexRenderComponentInstance)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I stitched bindings in a hop and a twitch,
Directives twirled round every tiny stitch,
Components wake with inputs to sing,
Outputs tumble out on a jubilant spring,
Hooray — flex-render hops into springtime! 🥕✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description explains the changes and motivation but does not follow the provided template structure with required sections like '🎯 Changes', '✅ Checklist', and '🚀 Release Impact'. Please follow the repository's PR description template by adding the required sections (🎯 Changes, ✅ Checklist, 🚀 Release Impact) with appropriate information for this PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding support for bindings and directives in FlexRender, which is the primary objective across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Jan 18, 2026

View your CI Pipeline Execution ↗ for commit 78ee0ef

Command Status Duration Result
nx affected --targets=test:format,test:eslint,t... ⛔ Cancelled 20s View ↗
nx run-many --targets=build -p @tanstack/table-... ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-20 18:13:35 UTC

@riccardoperra
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@packages/angular-table/src/flex-render/flexRenderComponent.ts`:
- Around line 33-51: Typo in the JSDoc example import — change the package name
in the example import from '@tantack/angular-table' to the correct
'@tanstack/angular-table' in the comment block near the flexRenderComponent
example so the documented import (flexRenderComponent) matches the actual
package name.
- Around line 65-83: The example import path contains a typo: update the import
in the JSDoc example for flexRenderComponent from "@tantack/angular-table" to
the correct "@tanstack/angular-table" so the documentation matches the actual
package name; locate the JSDoc block near the flexRenderComponent declaration
and change the string in the import statement.
🧹 Nitpick comments (1)
packages/angular-table/src/flex-render/flexRenderComponent.ts (1)

86-107: Consider adding a warning about mutually exclusive options.

The JSDoc mentions that bindings shouldn't be used together with inputs/outputs, but there's no runtime validation. Consider whether a development-mode warning would be helpful if users accidentally combine both approaches.

💡 Optional: Add dev-mode warning
export function flexRenderComponent<TComponent = any>(
  component: Type<TComponent>,
  options?: FlexRenderOptions<Inputs<TComponent>, Outputs<TComponent>>,
): FlexRenderComponent<TComponent> {
  const { inputs, injector, outputs, directives, bindings } = options ?? {}
  
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
    if (bindings?.length && (inputs || outputs)) {
      console.warn(
        '[`@tanstack/angular-table`] Using `bindings` together with `inputs`/`outputs` is not recommended. ' +
        'Choose one approach for consistency.'
      )
    }
  }
  
  return new FlexRenderComponentInstance(/* ... */)
}

@riccardoperra
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@packages/angular-table/src/flex-render/flexRenderComponent.ts`:
- Around line 245-251: The interface declares mutable properties "bindings?:
CreateComponentBindings" and "directives?: CreateComponentDirectives" but the
implementation type FlexRenderComponentInstance marks them as readonly; update
the interface to declare both properties as readonly (e.g., "readonly bindings?:
CreateComponentBindings" and "readonly directives?: CreateComponentDirectives")
so the interface matches the implementation and the TypeScript "implements"
check passes.
- Around line 88-101: The JSDoc links reference the non-existent option
"FlexRenderOptions#binding" — update both occurrences that appear near the
inputs?: TInputs and the outputs documentation (the paragraph referencing
OutputEmitterRef#subscribe) to point to the correct option name
"FlexRenderOptions#bindings" so the {`@link` ...} tags read {`@link`
FlexRenderOptions#bindings}.

@riccardoperra
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@riccardoperra riccardoperra marked this pull request as ready for review January 20, 2026 18:09
@riccardoperra riccardoperra force-pushed the feat/angular-20-flexrender-bindings branch from afe86ba to 267c718 Compare January 20, 2026 18:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/angular-table/src/flex-render/flexRenderComponent.ts`:
- Around line 123-124: The JSDoc comment for the helper uses square-bracket tag
syntax "[`@link` FlexRenderComponent]" which won't render; update the JSDoc to use
the correct inline tag syntax "{`@link` FlexRenderComponent}" in the comment above
the helper function that creates a FlexRenderComponent instance (the comment
referencing FlexRenderComponent in flexRenderComponent.ts) so IDE/tooling will
render a clickable link.
♻️ Duplicate comments (1)
packages/angular-table/src/flex-render/flexRenderComponent.ts (1)

245-251: Add readonly modifier for consistency.

The bindings and directives properties lack the readonly modifier, unlike all other properties in this interface (lines 209-239). The implementing class (FlexRenderComponentInstance) declares these as readonly at lines 271-272. For API consistency, align the interface.

📝 Proposed fix
-  bindings?: CreateComponentBindings
+  readonly bindings?: CreateComponentBindings
   /**
    * Directives that should be applied to the component.
    *
    * `@see` {FlexRenderOptions#directives}
    */
-  directives?: CreateComponentDirectives
+  readonly directives?: CreateComponentDirectives

Comment on lines 123 to 124
/**
* Helper function to create a [@link FlexRenderComponent] instance, with better type-safety.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix JSDoc link syntax.

JSDoc inline tags use curly braces, not square brackets. The current syntax won't render as a clickable link in IDE tooltips or generated documentation.

📝 Proposed fix
-/**
- * Helper function to create a [`@link` FlexRenderComponent] instance, with better type-safety.
+/**
+ * Helper function to create a {`@link` FlexRenderComponent} instance, with better type-safety.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Helper function to create a [@link FlexRenderComponent] instance, with better type-safety.
/**
* Helper function to create a {`@link` FlexRenderComponent} instance, with better type-safety.
🤖 Prompt for AI Agents
In `@packages/angular-table/src/flex-render/flexRenderComponent.ts` around lines
123 - 124, The JSDoc comment for the helper uses square-bracket tag syntax
"[`@link` FlexRenderComponent]" which won't render; update the JSDoc to use the
correct inline tag syntax "{`@link` FlexRenderComponent}" in the comment above the
helper function that creates a FlexRenderComponent instance (the comment
referencing FlexRenderComponent in flexRenderComponent.ts) so IDE/tooling will
render a clickable link.

@riccardoperra riccardoperra merged commit e0b876a into alpha Jan 20, 2026
2 of 4 checks passed
@riccardoperra riccardoperra deleted the feat/angular-20-flexrender-bindings branch January 20, 2026 18:12
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.

2 participants