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

Table | ReferenceError: Cannot access 'ColumnFilter' before initialization #11931

Closed
yamennassif opened this issue Sep 14, 2022 · 14 comments · Fixed by #12042 or #12056
Closed

Table | ReferenceError: Cannot access 'ColumnFilter' before initialization #11931

yamennassif opened this issue Sep 14, 2022 · 14 comments · Fixed by #12042 or #12056
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@yamennassif
Copy link

Describe the bug

While running tests into my application i got the following error:

...
ReferenceError: Cannot access 'ColumnFilter' before initialization
....
import {TableModule} from "primeng/table";
....
at Object.<anonymous> (node_modules/primeng/fesm2020/primeng-table.mjs:4023:176)
at Object.<anonymous> (src/app/app.module.ts:23:1)
at Object.<anonymous> (src/app/app.component.spec.ts:8:1)
....

traced down the error in primeng-table.mjs
and the error was the class ColumnFilter was initiated after the call for it in the following line:
ColumnFilterFormElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ColumnFilterFormElement, deps: [{ token: Table }, { token: ColumnFilter }], target: i0.ɵɵFactoryTarget.Component });

simply moving the class ColumnFilter 1 line before 4023 fixed the issue and everything worked.

Environment

Linux Jest tests.

Reproducer

No response

Angular version

14.0.1

PrimeNG version

14.1.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

17.8.0

Browser(s)

CLI

Steps to reproduce the behavior

  1. import {TableModule} from "primeng/table";
  2. run npm test:ci which is Jest

Expected behavior

I expect that the problem is solved

@yamennassif yamennassif added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 14, 2022
@stedel
Copy link

stedel commented Sep 14, 2022

We're seeing the same error running PrimeNG 14.1.0, Angular 14.2.1 on Node 16.17.0

● Test suite failed to run

    ReferenceError: Cannot access 'ColumnFilter' before initialization

       7 | import { DropdownModule } from 'primeng/dropdown';
       8 | import { ProgressBarModule } from 'primeng/progressbar';
    >  9 | import { TableModule } from 'primeng/table';
         | ^
      10 | import { ToolbarModule } from 'primeng/toolbar';
      11 | import { SharedModule as ACSharedModule } from '../../shared/shared.module';
      12 | import { PermissionsConfigurationComponent } from './permissions-configuration.component';

      at Object.<anonymous> (node_modules/primeng/fesm2020/primeng-table.mjs:4023:176)

@Jonnyprof
Copy link

Same here. This error was introduced with version v14.1.0, two days ago

@MaximeKoitsalu
Copy link

Getting the same, error. Reverting until fix is released.

@Virssello
Copy link

Any new news?

@mo0om
Copy link

mo0om commented Oct 3, 2022

I have the same problem. So @yamennassif, like you, when I moved ColumnFilter on top of the line for fesm2015 it was ok.
you think it's a packager problem?

@Delagen
Copy link
Contributor

Delagen commented Oct 3, 2022

@mo0om It is introduced cyclomatic dependency problem, not packager

@mo0om
Copy link

mo0om commented Oct 5, 2022

thank you @Delagen

@stedel
Copy link

stedel commented Oct 6, 2022

The problem stil occurs on PrimeNG v14.1.2

@Flomaz
Copy link

Flomaz commented Oct 11, 2022

I was hoping to use primeng in a new project but I have the same error with ColumFilter when running tests.

Tests are working with Karma, but not with Jest

Angular version
14.2.0

PrimeNG version
14.1.2

As a workaround, modify primeng-table.mjs is ok

Will you fix this problem in a next version ?
Thanks for your work !

@cetincakiroglu cetincakiroglu changed the title Component: PrimeNG TAble Table | ReferenceError: Cannot access 'ColumnFilter' before initialization Oct 18, 2022
@cetincakiroglu cetincakiroglu added this to the 14.1.3 milestone Oct 18, 2022
cetincakiroglu added a commit that referenced this issue Oct 18, 2022
cetincakiroglu added a commit that referenced this issue Oct 18, 2022
cetincakiroglu added a commit that referenced this issue Oct 18, 2022
cetincakiroglu added a commit that referenced this issue Oct 18, 2022
Fixed #11931 - Table | ReferenceError: Cannot access 'ColumnFilter' before initialization
@brianpooe
Copy link

This issue is not resolved getting the same error with jest on version 14.1.2.

Work around for jest users. Revert to version 14.0.1 and primeicons 5.0.0

@viceice
Copy link

viceice commented Oct 20, 2022

This issue is not resolved getting the same error with jest on version 14.1.2.

Work around for jest users. Revert to version 14.0.1 and primeicons 5.0.0

Nobody said this. The fix is merged 2 days ago and v14.1.2 was released 22days ago. so it could never be fixed in that release 😉

@yamennassif
Copy link
Author

Is there any idea when the next release is going to be ?

@totek
Copy link

totek commented Dec 5, 2022

Hello guys,
Any idea if this issue is going to be resolved anytime soon?
Many thanks!

@kiesel
Copy link

kiesel commented Jan 26, 2023

We've encountered the same problem; upgrading to 14.2.3fixed it, it was released on 2022-12-14. I believe, this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet