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

v18 - CSS Layers for example with Tailwind CSS fail when appending styles to header and SSR enabled #16595

Closed
EnricoMessall opened this issue Oct 20, 2024 · 0 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@EnricoMessall
Copy link
Contributor

Describe the bug

When adding for example the option:

options: {
        cssLayer: {
            name: 'primeng',
            order: 'primeng'
        }
    },

and having Angular SSR enabled the rendering fails and all css will only be load on client side. This happens due to a not supported "this.document.head.prepend" function which is called when using layers through:

this.baseStyle.load(layerOrder, { name: 'layer-order', first: true, ...this.styleOptions });

Environment

MacOS 15.0.1
Chrome 130.0

Using PrimeNG repository with showcase

Reproducer

No response

Angular version

18.0.1

PrimeNG version

18.0.0-beta.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

22.7.0

Browser(s)

Chrome 130

Steps to reproduce the behavior

  1. Go to "app-theme.ts" in primeng project
  2. Change:
export default {
    preset: Noir,
    options: {
        darkModeSelector: '.p-dark',
    },
};

to

export default {
    preset: Noir,
    options: {
        darkModeSelector: '.p-dark',
        cssLayer: {
            name: 'primeng',
            order: 'primeng'
        }
    },
};
  1. Start PrimeNG Showcase
  2. Errors will rise, pages will flicker

Expected behavior

CSS is loaded into the header already on service side and no flickering is happen

@EnricoMessall EnricoMessall added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 20, 2024
EnricoMessall added a commit to Arematics/primeng that referenced this issue Oct 20, 2024
 + Use custom implementation instead of not known prepend on server side
@cetincakiroglu cetincakiroglu added this to the 18.0.0-rc.1 milestone Oct 26, 2024
@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 18, 2024
@mertsincan mertsincan self-assigned this Nov 18, 2024
@mertsincan mertsincan moved this to Todo in PrimeNG Nov 19, 2024
@mertsincan mertsincan closed this as completed by moving to Done in PrimeNG Nov 19, 2024
@mertsincan mertsincan reopened this Nov 19, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 19, 2024
@mertsincan mertsincan removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 19, 2024
@mertsincan mertsincan removed this from PrimeNG Nov 20, 2024
@mertsincan mertsincan removed this from PrimeNG Nov 20, 2024
mertsincan added a commit that referenced this issue Nov 28, 2024
@mertsincan mertsincan moved this to Done in PrimeNG Nov 28, 2024
@mertsincan mertsincan closed this as completed by moving to Done in PrimeNG Nov 28, 2024
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Nov 28, 2024
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
Status: Done
3 participants