Skip to content

Commit 8b1bd1f

Browse files
committed
deps: mui v5to v6, drop mui/lab Refs: KK-1543
1 parent 4e88d16 commit 8b1bd1f

12 files changed

Lines changed: 99 additions & 278 deletions

File tree

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@
4242
"@apollo/client": "^3.8.4",
4343
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
4444
"@hookform/resolvers": "^3.3.1",
45-
"@mui/icons-material": "^5.14.11",
46-
"@mui/lab": "^5.0.0-alpha.146",
47-
"@mui/material": "^5.14.11",
45+
"@mui/icons-material": "^6.5.0",
46+
"@mui/material": "^6.5.0",
4847
"@nabla/vite-plugin-eslint": "^3.0.1",
4948
"@sentry/browser": "^10.58.0",
5049
"@tanstack/react-query": "^5.101.0",

src/common/components/imageField/ImageUploadField.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ const ImageUploadField = ({
121121
label={'events.fields.image.label'}
122122
accept={{ 'image/*': ['.jpeg', '.jpg', '.png', '.gif', '.webp'] }}
123123
placeholder={
124-
<Box display="inline-flex" alignItems="center">
124+
<Box
125+
sx={{
126+
display: 'inline-flex',
127+
alignItems: 'center',
128+
}}
129+
>
125130
<InsertPhotoIcon />
126131
{translate('events.fields.imageInput.label')}
127132
</Box>

src/common/components/viewTitle/__tests__/__snapshots__/ViewTitle.test.jsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
exports[`ViewTitle > renders an empty title when record context is empty 1`] = `
44
<div>
55
<div
6-
class="MuiCardHeader-root css-185gdzj-MuiCardHeader-root"
6+
class="MuiCardHeader-root css-149tc0y-MuiCardHeader-root"
77
>
88
<div
9-
class="MuiCardHeader-content css-1qbkelo-MuiCardHeader-content"
9+
class="MuiCardHeader-content css-1jkp9bu-MuiCardHeader-content"
1010
/>
1111
</div>
1212
</div>
@@ -15,10 +15,10 @@ exports[`ViewTitle > renders an empty title when record context is empty 1`] = `
1515
exports[`ViewTitle > renders an empty title when translations.FI.name does not exist 1`] = `
1616
<div>
1717
<div
18-
class="MuiCardHeader-root css-185gdzj-MuiCardHeader-root"
18+
class="MuiCardHeader-root css-149tc0y-MuiCardHeader-root"
1919
>
2020
<div
21-
class="MuiCardHeader-content css-1qbkelo-MuiCardHeader-content"
21+
class="MuiCardHeader-content css-1jkp9bu-MuiCardHeader-content"
2222
/>
2323
</div>
2424
</div>

src/domain/application/layout/kukkuuPageLayout/KukkuuPageLayout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,4 @@ const KukkuuPageLayout = ({
7272
</Box>
7373
);
7474
};
75-
7675
export default KukkuuPageLayout;

src/domain/authentication/LoginPage.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,30 @@ const LoginPage = () => {
4444
<IsTestEnvironmentLabel />
4545
</p>
4646
<Button
47-
sx={{
48-
marginTop: '1rem',
49-
width: '100%',
50-
backgroundColor: isTest ? '#00D7A7' : undefined,
51-
'&:hover': {
52-
backgroundColor: isTest ? '#00a17d' : undefined,
47+
sx={[
48+
{
49+
marginTop: '1rem',
50+
width: '100%',
5351
},
54-
}}
52+
isTest
53+
? {
54+
backgroundColor: '#00D7A7',
55+
}
56+
: {
57+
backgroundColor: null,
58+
},
59+
isTest
60+
? {
61+
'&:hover': {
62+
backgroundColor: '#00a17d',
63+
},
64+
}
65+
: {
66+
'&:hover': {
67+
backgroundColor: null,
68+
},
69+
},
70+
]}
5571
variant="contained"
5672
color="secondary"
5773
onClick={handleLogin}

src/domain/eventsAndEventGroups/list/EventsAndEventGroupsList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ const EventsAndEventGroupsList = () => {
9797
if (!record) {
9898
return null;
9999
}
100-
101100
return when(
102101
record,
103102
() => translate('eventsAndEventGroups.list.type.event.label'),
@@ -122,7 +121,6 @@ const EventsAndEventGroupsList = () => {
122121
if (!record) {
123122
return null;
124123
}
125-
126124
return when(
127125
record,
128126
(event: EventNode) => {

src/domain/messages/detail/MessageDetailsToolbar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,4 @@ const MessageDetailToolbar = () => {
116116
</TopToolbar>
117117
);
118118
};
119-
120119
export default MessageDetailToolbar;

src/domain/ticketValidation/OccurrenceCard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ const OccurrenceCard = ({ eventName, venueName, occurrenceTime }: Props) => {
2626
</Card>
2727
);
2828
};
29-
3029
export default OccurrenceCard;

src/domain/ticketValidation/TicketValidationPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CancelIcon from '@mui/icons-material/Cancel';
1111
import { useParams } from 'react-router-dom';
1212
import { useTranslate, Loading } from 'react-admin';
1313
import Typography from '@mui/material/Typography';
14-
import Alert from '@mui/lab/Alert';
14+
import Alert from '@mui/material/Alert';
1515
import { ApolloProvider } from '@apollo/client';
1616

1717
import unauthenticatedClient from '../../api/apolloClient/unauthenticatedClient';

vite.config.ts

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,7 @@
1-
import path from 'path';
2-
31
import { defineConfig, loadEnv } from 'vite';
42
import react from '@vitejs/plugin-react';
53
import eslint from '@nabla/vite-plugin-eslint';
64

7-
/**
8-
* Rolldown (Vite 8 dep pre-bundler) has a bug: when @mui/material and any
9-
* @mui/material/* subpath are both dep-optimization entries, Rolldown creates
10-
* shared chunks that CALL init_*() functions without defining or importing
11-
* them — causing ReferenceErrors in the browser.
12-
*
13-
* This plugin fixes that in two passes over the generateBundle output:
14-
* Pass 1 — catalogue every init_* definition and export across all chunks
15-
* Pass 2 — for each chunk with dangling init_* calls:
16-
* a) if the function is already exported elsewhere → add import
17-
* b) if the function is defined but unexported elsewhere →
18-
* add an export to that chunk, then add the import here
19-
*/
20-
const fixRolldownDanglingInits = {
21-
name: 'fix-rolldown-dangling-inits',
22-
generateBundle(_opts: unknown, bundle: Record<string, any>) {
23-
type InitInfo = { file: string; exported: boolean; alias: string };
24-
// localName → { file, exported, alias }
25-
const initMap = new Map<string, InitInfo>();
26-
27-
// ── Pass 1: catalogue ──────────────────────────────────────────────────
28-
for (const [fileName, chunk] of Object.entries(bundle)) {
29-
if (chunk.type !== 'chunk') continue;
30-
const code: string = chunk.code ?? '';
31-
32-
// Collect all var init_XXX = __esmMin(...) definitions (unexported by default)
33-
for (const m of code.matchAll(/\bvar (init_\w+)\s*=\s*__esmMin/g)) {
34-
const name = m[1];
35-
if (!initMap.has(name)) {
36-
initMap.set(name, { file: fileName, exported: false, alias: name });
37-
}
38-
}
39-
40-
// Mark exported ones and record their export alias
41-
for (const exportMatch of code.matchAll(/export\s*\{([^}]+)\}/g)) {
42-
for (const item of exportMatch[1].split(',').map((s) => s.trim())) {
43-
const m = item.match(/^(\w+)\s+as\s+(\w+)$/);
44-
if (m && m[1].startsWith('init_')) {
45-
const entry = initMap.get(m[1]);
46-
if (entry) {
47-
entry.exported = true;
48-
entry.alias = m[2];
49-
} else {
50-
initMap.set(m[1], {
51-
file: fileName,
52-
exported: true,
53-
alias: m[2],
54-
});
55-
}
56-
} else if (/^\w+$/.test(item) && item.startsWith('init_')) {
57-
const entry = initMap.get(item);
58-
if (entry) {
59-
entry.exported = true;
60-
entry.alias = item;
61-
} else {
62-
initMap.set(item, {
63-
file: fileName,
64-
exported: true,
65-
alias: item,
66-
});
67-
}
68-
}
69-
}
70-
}
71-
}
72-
73-
// ── Pass 2: fix dangling calls ─────────────────────────────────────────
74-
for (const [, chunk] of Object.entries(bundle)) {
75-
if (chunk.type !== 'chunk') continue;
76-
const code: string = chunk.code ?? '';
77-
78-
const importLines = code
79-
.split('\n')
80-
.filter((l: string) => l.trimStart().startsWith('import '));
81-
82-
const calledInits = new Set(
83-
[...code.matchAll(/\b(init_\w+)\(\)/g)].map((m) => m[1])
84-
);
85-
86-
const toAdd: string[] = [];
87-
88-
for (const initName of calledInits) {
89-
const defined =
90-
code.includes(`var ${initName} =`) ||
91-
code.includes(`function ${initName}(`);
92-
const imported = importLines.some((l: string) => l.includes(initName));
93-
if (defined || imported) continue; // already ok
94-
95-
const info = initMap.get(initName);
96-
if (!info) continue;
97-
98-
// Ensure the function is exported from its source chunk
99-
if (!info.exported) {
100-
const srcChunk = bundle[info.file];
101-
if (srcChunk?.type === 'chunk') {
102-
srcChunk.code =
103-
(srcChunk.code as string) + `\nexport { ${initName} };\n`;
104-
srcChunk.map = null;
105-
info.exported = true;
106-
info.alias = initName; // use full name since we control the export
107-
}
108-
}
109-
110-
if (info.exported) {
111-
const stmt = `import { ${info.alias} as ${initName} } from "./${info.file}";`;
112-
if (!toAdd.includes(stmt)) toAdd.push(stmt);
113-
}
114-
}
115-
116-
if (toAdd.length > 0) {
117-
chunk.code = toAdd.join('\n') + '\n' + code;
118-
chunk.map = null;
119-
}
120-
}
121-
},
122-
};
123-
1245
export default ({ mode }: any) => {
1256
// Load app-level env vars to node-level env vars.
1267
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
@@ -136,26 +17,6 @@ export default ({ mode }: any) => {
13617
},
13718
resolve: {
13819
tsconfigPaths: true,
139-
alias: {
140-
// Rolldown (Vite 8) doesn't auto-synthesize CJS default exports;
141-
// redirect all @mui/icons-material sub-path imports to the ESM build.
142-
'@mui/icons-material': path.resolve(
143-
__dirname,
144-
'node_modules/@mui/icons-material/esm'
145-
),
146-
screens: path.resolve(__dirname, './src/screens'),
147-
},
148-
},
149-
optimizeDeps: {
150-
include: [
151-
'@emotion/react',
152-
'@emotion/styled',
153-
'@emotion/cache',
154-
'@mui/material',
155-
],
156-
rolldownOptions: {
157-
plugins: [fixRolldownDanglingInits],
158-
},
15920
},
16021
build: {
16122
outDir: 'build',

0 commit comments

Comments
 (0)