Skip to content

Commit e16e15e

Browse files
author
teable-bot
committed
[sync] fix(t979): form page error (#1113)
Synced from teableio/teable-ee@2047f84
1 parent 465dda2 commit e16e15e

File tree

7 files changed

+93
-13
lines changed

7 files changed

+93
-13
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable @next/next/no-before-interactive-script-outside-document */
2+
import Script from 'next/script';
3+
4+
export const SideBarScript = () => {
5+
return (
6+
<Script id="init-sidebar-width" strategy="beforeInteractive">
7+
{`
8+
let sidebarWidth = 288;
9+
try {
10+
sidebarWidth = JSON.parse(localStorage.getItem('ls_sidebar') || '{}')?.state?.width || 288;
11+
} catch (error) {
12+
console.error('Error parsing sidebar width', error);
13+
}
14+
document.documentElement.style.setProperty('--sidebar-width', sidebarWidth.toString() + 'px');
15+
`}
16+
</Script>
17+
);
18+
};

apps/nextjs-app/src/features/app/components/sidebar/Sidebar.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ export const Sidebar: FC<PropsWithChildren<ISidebarProps>> = (props) => {
6565
[headerLeft, children, toggleSidebar]
6666
);
6767

68+
// During SSR/hydration, render consistent layout to avoid mismatch
69+
if (!isHydrated) {
70+
return (
71+
<div
72+
className="h-full shrink-0 border-r"
73+
style={{ width: `var(--sidebar-width` }}
74+
onContextMenu={(e) => e.preventDefault()}
75+
>
76+
<div className={sidebarClassName}>{sidebarContent}</div>
77+
</div>
78+
);
79+
}
80+
81+
// After hydration, safe to check client-only values
6882
if (isMobile) {
6983
return (
7084
<SheetWrapper>
@@ -100,18 +114,6 @@ export const Sidebar: FC<PropsWithChildren<ISidebarProps>> = (props) => {
100114
);
101115
}
102116

103-
if (!isHydrated) {
104-
return (
105-
<div
106-
className="h-full shrink-0 border-r"
107-
style={{ width }}
108-
onContextMenu={(e) => e.preventDefault()}
109-
>
110-
<div className={sidebarClassName}>{sidebarContent}</div>
111-
</div>
112-
);
113-
}
114-
115117
return (
116118
<Resizable
117119
className="h-full shrink-0 border-r"

apps/nextjs-app/src/pages/_app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useEffect } from 'react';
1111
import { Guide } from '@/components/Guide';
1212
import { GoogleAnalytics, MicrosoftClarity, Umami } from '@/components/Metrics';
1313
import RouterProgressBar from '@/components/RouterProgress';
14+
import { SideBarScript } from '@/features/app/components/sidebar/SideBarScript';
1415
import type { IServerEnv } from '@/lib/server-env';
1516
import type { NextPageWithLayout } from '@/lib/type';
1617
import { colors } from '@/themes/colors';
@@ -68,6 +69,7 @@ const MyApp = (appProps: AppPropsWithLayout) => {
6869
<MicrosoftClarity clarityId={env.microsoftClarityId} user={user} />
6970
<Umami umamiWebSiteId={env.umamiWebSiteId} umamiUrl={env.umamiUrl} user={user} />
7071
<GoogleAnalytics gaId={env.gaId} user={user} />
72+
<SideBarScript />
7173
<script
7274
dangerouslySetInnerHTML={{
7375
__html: `
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react';
2+
import type { SVGProps } from 'react';
3+
const TriggerRecordMatchesConditions = (props: SVGProps<SVGSVGElement>) => (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="1em"
7+
height="1em"
8+
fill="none"
9+
viewBox="0 0 24 24"
10+
{...props}
11+
>
12+
<path
13+
stroke="#14B8A6"
14+
strokeLinecap="round"
15+
strokeLinejoin="round"
16+
strokeWidth={2}
17+
d="M22 3H2l8 9.46V19l4 2v-8.54z"
18+
/>
19+
</svg>
20+
);
21+
export default TriggerRecordMatchesConditions;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as React from 'react';
2+
import type { SVGProps } from 'react';
3+
const TriggerWebhook = (props: SVGProps<SVGSVGElement>) => (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="1em"
7+
height="1em"
8+
fill="none"
9+
viewBox="0 0 24 24"
10+
{...props}
11+
>
12+
<path
13+
stroke="#F43F5E"
14+
strokeLinecap="round"
15+
strokeLinejoin="round"
16+
strokeWidth={2}
17+
d="M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2"
18+
/>
19+
<path
20+
stroke="#F43F5E"
21+
strokeLinecap="round"
22+
strokeLinejoin="round"
23+
strokeWidth={2}
24+
d="m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06"
25+
/>
26+
<path
27+
stroke="#F43F5E"
28+
strokeLinecap="round"
29+
strokeLinejoin="round"
30+
strokeWidth={2}
31+
d="m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 1 1 0 8"
32+
/>
33+
</svg>
34+
);
35+
export default TriggerWebhook;

packages/icons/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ export { default as Translation } from './components/Translation';
193193
export { default as Trash } from './components/Trash';
194194
export { default as Trash2 } from './components/Trash2';
195195
export { default as TriggerButton } from './components/TriggerButton';
196+
export { default as TriggerWebhook } from './components/TriggerWebhook';
196197
export { default as TriggerUpdateRecord } from './components/TriggerUpdateRecord';
197198
export { default as TriggerSchedule } from './components/TriggerSchedule';
198199
export { default as TriggerForm } from './components/TriggerForm';
199200
export { default as TriggerCreateRecord } from './components/TriggerCreateRecord';
200201
export { default as TriggerCreateOrUpdate } from './components/TriggerCreateOrUpdate';
202+
export { default as TriggerRecordMatchesConditions } from './components/TriggerRecordMatchesConditions';
201203
export { default as Undo2 } from './components/Undo2';
202204
export { default as User } from './components/User';
203205
export { default as UserEdit } from './components/UserEdit';

packages/sdk/src/components/filter/view-filter/custom-component/BaseFieldValue.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export function BaseFieldValue(props: IBaseFieldValue) {
363363
);
364364
case FieldType.SingleSelect:
365365
return wrapWithReference(
366-
ARRAY_OPERATORS.includes(operator) ? (
366+
ARRAY_OPERATORS.includes(operator) || field?.isMultipleCellValue ? (
367367
<FilterMultipleSelect
368368
field={field}
369369
modal={modal}

0 commit comments

Comments
 (0)