primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Component: PrimeNG TAble

Open yamennassif opened this issue 3 years ago • 3 comments

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 avatar Sep 14 '22 09:09 yamennassif

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)

stedel avatar Sep 14 '22 12:09 stedel

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

Jonnyprof avatar Sep 15 '22 08:09 Jonnyprof

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

MaximeKoitsalu avatar Sep 16 '22 09:09 MaximeKoitsalu

Any new news?

Virssello avatar Sep 29 '22 12:09 Virssello

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?

mo0om avatar Oct 03 '22 13:10 mo0om

@mo0om It is introduced cyclomatic dependency problem, not packager

Delagen avatar Oct 03 '22 14:10 Delagen

thank you @Delagen

mo0om avatar Oct 05 '22 15:10 mo0om

The problem stil occurs on PrimeNG v14.1.2

stedel avatar Oct 06 '22 05:10 stedel

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 !

Flomaz avatar Oct 11 '22 14:10 Flomaz

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

brianpooe avatar Oct 20 '22 15:10 brianpooe

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 😉

viceice avatar Oct 20 '22 15:10 viceice

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

yamennassif avatar Oct 20 '22 15:10 yamennassif

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

totek avatar Dec 05 '22 10:12 totek

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.

kiesel avatar Jan 26 '23 08:01 kiesel