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(angular-table): View is not updated anymore when flexRenderDirective is instantiated the first time with an empty value #5626

Conversation

riccardoperra
Copy link
Contributor

@riccardoperra riccardoperra commented Jun 27, 2024

While using Angular table adapter in our application, we discovered an issue with FlexRenderDirective that prevents the content from being shown if the cell renders a null | undefined value the first time.

Use case:

  • Render a table component with an empty cell (null | undefined value)
  • Refresh the table data with the same cell valuated (e.g. after the user does an update operation)
  • While the new data contains the value, the cell is still empty

The issue is related to the current rendering mechanism, which is invoked inside the ngOnInit hook (one-time, only after Angular initialized all the inputs).

I moved the logic inside ngOnChanges, so that everything is invoked whenever the inputs change. I had to update some test according to this fix, so I moved the first two check about null | undefined in order to be sure that the content is reactive and always rendered (except for null | undefined)

Since we are using ngOnChanges, we don't need anymore to call the markForCheck while rendering a Component or TemplateRef inside the ngDoCheck

Copy link

nx-cloud bot commented Jun 27, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f03fd09. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@riccardoperra riccardoperra changed the title fix: update view when content type change fix(angular-table): View is not updated anymore when flexRenderDirective have a null|undefined content Jun 27, 2024
@riccardoperra riccardoperra changed the title fix(angular-table): View is not updated anymore when flexRenderDirective have a null|undefined content fix(angular-table): View is not updated anymore when flexRenderDirective it is instantiated the first time with an empty value Jun 27, 2024
@riccardoperra riccardoperra changed the title fix(angular-table): View is not updated anymore when flexRenderDirective it is instantiated the first time with an empty value fix(angular-table): View is not updated anymore when flexRenderDirective is instantiated the first time with an empty value Jun 27, 2024
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