Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v6.x, v7.x
Current Behavior
When Server Side Rendering is used, the ion-split-pane
component is broken. The menu pane will not show up along with any menu-button in the page toolbar. Client-side hydration does not make it re-appear.
This is related to issue #24714, which was supposedly 'fixed' in #26854.
Unfortunately this turns half-broken SSR websites (which needed client hydration) into completely broken websites because client hydration does not fix it, and the menu pane will never show up.
Expected Behavior
Either the ion-split-pane shows up nicely in server-side-rendered pages, or it does not show up but client-side hydration fixes it (old behavior).
Steps to Reproduce
Taken from my comment on the linked issue:
1. Create the project
ionic start myApp sidemenu --type angular
cd myApp
npm install @angular/animations
ng add @nguniversal/express-engine
npm install @ionic/angular-server
(you might need to run npx ionic start
...)
2. Enable Ionic SSR
And updating app.server.module.ts with:
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
+ import { IonicServerModule } from '@ionic/angular-server';
@NgModule({
imports: [
AppModule,
ServerModule,
+ IonicServerModule
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
3. Update server.js
I had to update server.js
because node:fs
and node:path
could not be found.
import { APP_BASE_HREF } from '@angular/common';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
-import { existsSync } from 'node:fs';
+import { existsSync } from 'fs';
-import { join } from 'node:path';
+import { join } from 'path';
import { AppServerModule } from './src/main.server';
4. Run
Build & serve the application with:
npm run build:ssr
npm run serve:ssr
Observe that the split pane does not appear:
Code Reproduction URL
https://github.com/Tvde1/ion-split-pane-SSR-bug-repro
Ionic Info
Ionic:
Ionic CLI : 5.4.16 (C:\Users\[...]\AppData\Local\npm-cache\_npx\864a9e3c2cd0cf50\node_modules\ionic)
Ionic Framework : not installed
@angular-devkit/build-angular : 16.0.2
@angular-devkit/schematics : 16.0.2
@angular/cli : 16.0.2
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.0.3
@capacitor/core : 5.0.3
Utility:
cordova-res : not installed
native-run : 1.7.2
System:
NodeJS : v20.2.0 (C:\Program Files\nodejs\node.exe)
npm : 9.6.6
OS : Windows 10
Additional Information
No response