Skip to content

Commit ddb6af1

Browse files
committed
[Dashboard] Fix: Memory optimizations to reduce build failures (#5903)
See https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage#disable-webpack-cache <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces optimizations to the webpack configuration and modifies several components to improve performance and fix TypeScript errors. ### Detailed summary - Added `webpackMemoryOptimizations` to `experimental` in `next.config.ts`. - Simplified `webpack` function by removing `dev` parameter. - Changed cache type to `memory` in `next.config.ts`. - Updated `abi-selector.tsx` to remove TypeScript error comments. - Enhanced `ApplyForOpCreditsForm.tsx` by streamlining `onChange` handling. - Modified `MarkdownRenderer` to handle optional `href` and added TypeScript error comments for future fixes. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent c06ecda commit ddb6af1

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

apps/dashboard/next.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,18 @@ function getConfig(): NextConfig {
192192
...baseNextConfig,
193193
experimental: {
194194
webpackBuildWorker: true,
195+
webpackMemoryOptimizations: true,
195196
},
196197
// @ts-expect-error - this is a valid option
197-
webpack: (config, { dev }) => {
198-
if (config.cache && !dev) {
198+
webpack: (config) => {
199+
if (config.cache) {
199200
config.cache = Object.freeze({
200201
type: "filesystem",
201202
maxMemoryGenerations: 0,
202203
});
204+
config.cache = Object.freeze({
205+
type: "memory",
206+
});
203207
}
204208
config.externals.push("pino-pretty");
205209
config.module = {

apps/dashboard/src/components/contract-components/contract-publish-form/abi-selector.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ export const AbiSelector: React.FC<AbiSelectorProps> = ({
3232
options={options}
3333
defaultValue={options.find((o) => o.value === defaultValue)}
3434
chakraStyles={{
35-
// @ts-expect-error - this works fine
3635
container: (provided) => ({
3736
...provided,
3837
width: "full",
3938
}),
4039
}}
4140
value={options.find((o) => o.value === value)}
42-
// @ts-expect-error - this works fine
4341
onChange={(selectedFn) => {
4442
if (selectedFn) {
4543
onChange((selectedFn as { label: string; value: string }).value);

apps/dashboard/src/components/contract-components/published-contract/markdown-renderer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const MarkdownRenderer: React.FC<{
9191

9292
a: (props) => (
9393
<Link
94-
href={props.href}
94+
href={props.href ?? "#"}
9595
target="_blank"
9696
{...cleanedProps(props)}
9797
className="mt-4 text-link-foreground hover:text-foreground"
@@ -103,6 +103,7 @@ export const MarkdownRenderer: React.FC<{
103103
if (code?.disableCodeHighlight) {
104104
return (
105105
<div className="my-4">
106+
{/* @ts-expect-error - TODO: fix this */}
106107
<PlainTextCodeBlock
107108
{...cleanedProps(props)}
108109
code={onlyText(props.children).trim()}
@@ -114,6 +115,7 @@ export const MarkdownRenderer: React.FC<{
114115
return (
115116
<div className="my-4">
116117
<CodeClient
118+
// @ts-expect-error - TODO: fix this
117119
lang={language}
118120
{...cleanedProps(props)}
119121
code={onlyText(props.children).trim()}

apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ export const ApplyForOpCreditsForm: React.FC<ApplyForOpCreditsFormProps> = ({
191191
}))}
192192
placeholder="Select industry"
193193
isRequired
194-
// @ts-expect-error - this works fine
195194
onChange={(value) => {
196195
if (value?.value) {
197196
form.setValue("superchain_verticals", value.value);
@@ -222,14 +221,10 @@ export const ApplyForOpCreditsForm: React.FC<ApplyForOpCreditsFormProps> = ({
222221
label: chain === "Optimism" ? "OP Mainnet" : chain,
223222
value: chain,
224223
}))}
225-
// @ts-expect-error - this works fine
226224
onChange={(values) => {
227225
form.setValue(
228226
"superchain_chain",
229-
values
230-
// @ts-expect-error - this works fine
231-
.map(({ value }) => value)
232-
.join(";"),
227+
values.map(({ value }) => value).join(";"),
233228
);
234229
}}
235230
isMulti

0 commit comments

Comments
 (0)