Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(space-next): support App Bridge #83

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Sep 13, 2024

What?

This PR implements App Bridge for Next.js Space Plugin starter.

The same implementation will be applied to tool-plugins/nextjs-starter in a separate PR (once this is approved merged)

Why?

JIRA: SHAPE-7006

How to test? (optional)

@eunjae-lee eunjae-lee marked this pull request as ready for review September 13, 2024 14:08
export default function Home(props: HomeProps) {
const toolContext = useToolContext();
export default function Home() {
const { completed } = useAppBridge({ type: 'space-plugin', oauth: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering if it is possible to create config file for this too? where the use can enable and disable app bridge

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 didn't consider the configurability in this implementation, as there's still the legacy nextjs project that doesn't use App Bridge. In case of Nuxt starter, we were already using nuxt-base in other projects, so we had to introduce the config to keep the backward compatibility. Now that App Bridge will be kind of the new default and it won't be visible and very quick to run, I think we can keep it as-is.

@eunjae-lee
Copy link
Contributor Author

todo for me: think about implementing this using middleware of next.js

@eunjae-lee
Copy link
Contributor Author

todo for me: think about implementing this using middleware of next.js

I've tried, and the implementation indeed looked better, but it doesn't work 🥲 Next.js' middleware runs on the Edge runtime, and app-extension-auth seems to be incompatible. Not sure how much of work it requires to convert app-extension-auth to be edge compatible. But for the sake of history, I'll add the commit and revert it right away. Later on, we could revisit the implementation here.

@BibiSebi BibiSebi self-requested a review September 18, 2024 12:42
Copy link
Contributor

@BibiSebi BibiSebi left a comment

Choose a reason for hiding this comment

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

Thank you for the effort and trying it out @eunjae-lee. lets get this done then :) 🚀

@eunjae-lee eunjae-lee merged commit 413eb33 into feat/space-nextjs-starter Sep 18, 2024
1 check passed
@eunjae-lee eunjae-lee deleted the SHAPE-7006-implement-app-bridge-functionality-for-nextjs-starter branch September 18, 2024 13:43
eunjae-lee added a commit that referenced this pull request Sep 18, 2024
* feat(space-next): add next.js starter for Space plugin

* feat(space-next): support App Bridge (#83)

* feat(space-next): support App Bridge

* add more examples

* update README

* fix: incomplete implemention using Next.js middleware

* Revert "fix: incomplete implemention using Next.js middleware"

This reverts commit 6a113a6.

* update .env.example
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.

2 participants