Skip to content

Commit 949f36e

Browse files
committed
breaking: reverse order of definePage - react-refresh sometimes breaks when the first parameter is not a react component
1 parent 22b1ce1 commit 949f36e

File tree

15 files changed

+32
-33
lines changed

15 files changed

+32
-33
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ Example:
168168
import React from 'react';
169169
import { definePage } from '@monoid-dev/split-pages/client';
170170

171-
export const A = definePage({}, (props) => {
171+
export const A = definePage((props) => {
172172
return <>A</>;
173-
});
173+
}, {});
174174
```
175175

176176
Usage:
@@ -185,14 +185,14 @@ import { definePage } from '@monoid-dev/split-pages/client';
185185
import { numberField, struct } from '@monoid-dev/reform';
186186

187187
export const A = definePage(
188+
({ a }) => {
189+
return <>{a}</>;
190+
},
188191
{
189192
props: struct({
190193
a: numberField(),
191194
}),
192195
},
193-
({ a }) => {
194-
return <>{a}</>;
195-
},
196196
);
197197
```
198198

demo/querystring/src/pages/A.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { definePage } from '@monoid-dev/split-pages/client';
33
import { stringField, struct } from '@monoid-dev/reform';
44

55
export const A = definePage(
6+
({ a }) => {
7+
return <>{a}</>;
8+
},
69
{
710
props: struct({
811
a: stringField(),
912
}),
1013
},
11-
({ a }) => {
12-
return <>{a}</>;
13-
},
1414
);

demo/querystring/src/pages/B.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const B = definePage({}, (props) => {
4+
export const B = definePage((props) => {
55
return <>B</>;
6-
});
6+
}, {});

demo/querystring/src/pages/C.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { definePage } from '@monoid-dev/split-pages/client';
33
import { string, struct, omittable } from '@monoid-dev/reform';
44

55
export const C = definePage(
6+
({ a }) => {
7+
return <>{a}</>;
8+
},
69
{
710
props: struct({
811
a: omittable(string()),
912
}),
1013
},
11-
({ a }) => {
12-
return <>{a}</>;
13-
},
1414
);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const NoMatch = definePage({}, (props) => {
4+
export const NoMatch = definePage((props) => {
55
return <>NoMatch</>;
6-
});
6+
}, {});

demo/readme/src/pages/A.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const A = definePage({}, (props) => {
4+
export const A = definePage((props) => {
55
return <>A</>;
6-
});
6+
}, {});

demo/readme/src/pages/B.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const B = definePage({}, (props) => {
4+
export const B = definePage((props) => {
55
return <>B</>;
6-
});
6+
}, {});

demo/readme/src/pages/NoMatch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const NoMatch = definePage({}, (props) => {
4+
export const NoMatch = definePage((props) => {
55
return <>NoMatch</>;
6-
});
6+
}, {});

demo/simple/pages/NoMatch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { definePage } from '@monoid-dev/split-pages/client';
33

4-
export const NoMatch = definePage({}, (props) => {
4+
export const NoMatch = definePage((props) => {
55
return <>NoMatch</>;
6-
});
6+
}, {});

demo/simple/pages/a.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import { struct, numberField } from '@monoid-dev/reform';
33
import { definePage } from '@monoid-dev/split-pages/client';
44

55
export const a = definePage(
6+
(props) => {
7+
const { id } = props;
8+
return <>{id}</>;
9+
},
610
{
711
props: struct({
812
id: numberField(),
913
}),
1014
},
11-
(props) => {
12-
const { id } = props;
13-
14-
return <>{id}</>;
15-
},
1615
);

0 commit comments

Comments
 (0)