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

fix(addon-doc): DocAPIItem throws error for signal-based output handlers #10292

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nsbarsukov
Copy link
Member

@nsbarsukov nsbarsukov commented Jan 31, 2025

Reproduction

Add the following code to any API documentation page:

protected debug = signal('');
<tr
    name="[debug]"
    tuiDocAPIItem
    type="string"
    [value]="debug()"
    (valueChange)="debug.set($event)"
>
    DEBUG
</tr>

Open http://localhost:3333/components/any/API?debug=42
It throws

ERROR Error: ASSERTION ERROR: Updating a signal during template or host binding execution is not allowed. [Expected=> null != null <=Actual]
    at throwError (core.mjs:328:11)
    at assertDefined (core.mjs:324:9)
    at Object.consumerMarkedDirty (core.mjs:11722:13)
    at consumerMarkDirty (core.mjs:2547:29)
    at producerNotifyConsumers (core.mjs:2529:17)
    at signalValueChanged (core.mjs:2837:5)
    at Function.signalSetFn [as set] (core.mjs:2847:9)
    at Page_ng_template_2_Template_tr_valueChange_11_listener (index.html:40:32)
    at executeListenerWithErrorHandling (core.mjs:16795:16)
    at Object.wrapListenerIn_markDirtyAndPreventDefault [as next] (core.mjs:16828:22)

@nsbarsukov nsbarsukov self-assigned this Jan 31, 2025
@nsbarsukov nsbarsukov requested a review from a team as a code owner January 31, 2025 10:40
@nsbarsukov nsbarsukov requested review from MarsiBarsi, waterplea, vladimirpotekhin and mdlufy and removed request for a team January 31, 2025 10:40
Copy link

lumberjack-bot bot commented Jan 31, 2025

Failed tests ❌

Before (main) ← Diff → After (local)

tests-addon-mobile-mobile--75f60--for-textfields-with-select-chromium-retry2/dropdown-mobile-with-select.diff.png
tests-demo-demo.pw-Demo-charts-legend-item-chromium-retry2/charts-legend-item/1.diff.png
tests-demo-demo.pw-Demo-charts-ring-chart-chromium-retry2/charts-ring-chart/2.diff.png
tests-demo-demo.pw-Demo-components-carousel-chromium-retry2/components-carousel/3.diff.png

(updated for commit 499ac55)

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.77%. Comparing base (5cb8d03) to head (499ac55).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10292   +/-   ##
=======================================
  Coverage   65.77%   65.77%           
=======================================
  Files        1241     1241           
  Lines       16232    16232           
  Branches     2382     2343   -39     
=======================================
  Hits        10676    10676           
- Misses       5242     5311   +69     
+ Partials      314      245   -69     
Flag Coverage Δ
summary 65.77% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

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

https://taiga-previews-demo--pr10292-doc-api-item-error-demo-69uc3ogo.web.app

(expires Sat, 01 Feb 2025 10:44:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 73dddc3c665194f3e11f18c16aeb71af4c289c37

Copy link

bundlemon bot commented Jan 31, 2025

BundleMon

Unchanged files (5)
Status Path Size Limits
demo/browser/main.(hash).js
308.91KB +10%
demo/browser/vendor.(hash).js
260.28KB +10%
demo/browser/runtime.(hash).js
46.51KB +10%
demo/browser/styles.(hash).css
20.93KB +10%
demo/browser/polyfills.(hash).js
11.18KB +10%

No change in files bundle size

Unchanged groups (1)
Status Path Size Limits
demo/browser/*..js
7.84MB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@@ -71,7 +71,7 @@ export class TuiDocAPIItem<T> implements OnInit {
@Output()
public readonly valueChange = new EventEmitter<T>();

public ngOnInit(): void {
public ngAfterViewInit(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Or should it be constructor? Since it's a snapshot that doesn't change

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, i'll investigate it!

Copy link
Member Author

Choose a reason for hiding this comment

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

@waterplea

Unfortunately, this function also uses input properties – constructor is not an option

@Input()
public name = '';

private parseParams(params: Params): void {
const name = this.clearBrackets(this.name);

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

Successfully merging this pull request may close these issues.

3 participants