Skip to content

Commit

Permalink
Update browser global definitions in app template
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmade committed Oct 21, 2024
1 parent 6ca1d69 commit 93c5767
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-bats-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@quilted/create': patch
---

Update browser global definitions in app template
6 changes: 5 additions & 1 deletion packages/create/templates/app-basic/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const context = {
} satisfies AppContext;

// Makes key parts of the app available in the browser console
Object.assign(globalThis, {app: context});
Object.defineProperty(globalThis, 'app', {
value: {context},
enumerable: false,
configurable: true,
});

hydrate(<App context={context} />);
6 changes: 5 additions & 1 deletion packages/create/templates/app-graphql/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const context = {
} satisfies AppContext;

// Makes key parts of the app available in the browser console
Object.assign(globalThis, {app: context});
Object.defineProperty(globalThis, 'app', {
value: {context},
enumerable: false,
configurable: true,
});

hydrate(<App context={context} />);
6 changes: 5 additions & 1 deletion packages/create/templates/app-trpc/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const context = {
} satisfies AppContext;

// Makes key parts of the app available in the browser console
Object.assign(globalThis, {app: context});
Object.defineProperty(globalThis, 'app', {
value: {context},
enumerable: false,
configurable: true,
});

hydrate(<App context={context} />);

0 comments on commit 93c5767

Please sign in to comment.