File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
apps/builder/app/builder/features/pages
packages/sdk-components-animation Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -1642,7 +1642,16 @@ export const PageSettings = ({
1642
1642
onDuplicate = { ( ) => {
1643
1643
const newPageId = duplicatePage ( pageId ) ;
1644
1644
if ( newPageId !== undefined ) {
1645
- onDuplicate ( newPageId ) ;
1645
+ // In `canvas.tsx`, within `subscribeStyles`, we use `requestAnimationFrame` (RAF) for style recalculation.
1646
+ // After `duplicatePage`, styles are not yet recalculated.
1647
+ // To ensure they are properly updated, we use double RAF.
1648
+ requestAnimationFrame ( ( ) => {
1649
+ // At this tick styles are updating
1650
+ requestAnimationFrame ( ( ) => {
1651
+ // At this tick styles are updated
1652
+ onDuplicate ( newPageId ) ;
1653
+ } ) ;
1654
+ } ) ;
1646
1655
}
1647
1656
} }
1648
1657
>
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from "vitest/config" ;
2
+ import { existsSync , readdirSync } from "node:fs" ;
3
+ import path from "node:path" ;
4
+
5
+ const isFolderEmpty = ( folderPath : string ) => {
6
+ if ( ! existsSync ( folderPath ) ) {
7
+ return true ; // Folder does not exist
8
+ }
9
+ const contents = readdirSync ( folderPath ) ;
10
+
11
+ return contents . length === 0 ;
12
+ } ;
13
+
14
+ const hasPrivateFolders = ! isFolderEmpty (
15
+ path . join ( __dirname , "../../packages/sdk-components-animation/private-src" )
16
+ ) ;
17
+
18
+ const conditions = hasPrivateFolders
19
+ ? [ "webstudio-private" , "webstudio" ]
20
+ : [ "webstudio" ] ;
2
21
3
22
export default defineConfig ( {
23
+ resolve : {
24
+ conditions,
25
+ } ,
26
+ ssr : {
27
+ resolve : {
28
+ conditions,
29
+ } ,
30
+ } ,
4
31
test : {
5
32
passWithNoTests : true ,
6
33
workspace : [
You can’t perform that action at this time.
0 commit comments