Skip to content

Conversation

@drew-harris
Copy link
Contributor

@drew-harris drew-harris commented Oct 31, 2025

  • adds cookie sync endpoint creator and endpointURI option in init
  • adds InstantSuspenseProvider in react package under @instantdb/react/nextjs
  • adds a sandbox page

Comment on lines -11 to +12
"module": "esnext",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "nodenext",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows importing from "sub exports", moduleResolution: "node" means compiles to support for node v10, node next raises the minimum version of node

@github-actions
Copy link
Contributor

View Vercel preview at instant-www-js-drewh-ssr-jsv.vercel.app.

return new Response('sync', {
headers: {
// 24 hour expiry
'Set-Cookie': `instant_refresh_token=${body.user.refresh_token}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=86400`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you're testing on localhost? I would expect the Secure field to prevent this from working.

// kick off a request to cache it
this.getCurrentUser();
this.getCurrentUser().then((userInfo) => {
this.syncUserToEndpoint(userInfo.user);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the cookie only lives for 24 hours, should we have something in reactor that periodically refreshes it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have it sync in the background when reactor gets init'd, not sure of a better solution? ideas welcome

}

async syncUserToEndpoint(user) {
if (this.config.endpointURI) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endpointURI seems too generic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i partially intentionally left it generic to account for more possible webhook actions in the future, also can't really think of a good name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants