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

Working with CAPACITOR JS #3

Closed
alanxp opened this issue Jun 23, 2024 · 7 comments
Closed

Working with CAPACITOR JS #3

alanxp opened this issue Jun 23, 2024 · 7 comments

Comments

@alanxp
Copy link

alanxp commented Jun 23, 2024

Got it working, however when using cpaacitor js where we use the exported "out" directory into webview, i ran into this error in xcode

[error] - Failed to fetch RSC payload for capacitor://localhost/admin/regions/65d2cd8d281b553da132e9be.

image

@zdenham
Copy link
Owner

zdenham commented Jun 24, 2024

Are you able to isolate this issue to something with next-static-utils? I'm not very familiar with capacitor, but would like to understand your use case a bit more

@alanxp
Copy link
Author

alanxp commented Jun 24, 2024

Are you able to isolate this issue to something with next-static-utils? I'm not very familiar with capacitor, but would like to understand your use case a bit more

image

I believe because it is expecting to have the page 65d2cd8d..html

The use case is simply export all static html site into a webview that capacitor has to show it as an "app" for android/ios. All it needs is the static html for it to work.

I can do it with Sveltekit Static Export, but can't seem to get it with Next.JS

@zdenham
Copy link
Owner

zdenham commented Jun 25, 2024

Are you using the useDynamicParams hook? or getStaticParams on your pages? We don't support using getStaticParams. Not sure I can help without more information unfortunately. If you are able to share a repo / steps to reproduce I can look into it

@alanxp
Copy link
Author

alanxp commented Jun 25, 2024

Are you using the useDynamicParams hook? or getStaticParams on your pages? We don't support using getStaticParams

App Router... using useDynamicParams ofc.
What capacitor does is if the link is a href="/regions/randomObjectIdHere123.html" it expects a randomObjectIdHere123.html, it could "simulate" the route next-static-fallback at least.

@zdenham
Copy link
Owner

zdenham commented Jun 25, 2024

Ah I see. So this seems like a capacitor specific issue that is incompatible with our approach.

We generate a "fallback" page and fetch data client side. If capacitor enforces that all pages need to exist, you'll need to either

  1. Generate all of your pages at build time using next.js generateStaticParams or
  2. If capacitor supports it, pass data as a query param e.g. /regions?objectId=[yourId]

I'd recommend option 2 if possible, because in a webview pretty urls aren't as important.

@zdenham
Copy link
Owner

zdenham commented Jun 26, 2024

going to close this issue for now, as we likely won't be able to support capacitor with our current approach--please lmk if you end up getting this resolved

@zdenham zdenham closed this as completed Jun 26, 2024
@alanxp
Copy link
Author

alanxp commented Jun 26, 2024

As far as i know Sveltekit exports only 1 index.html and the rest of routes and pages are with javascript. So its basicly a SPA. I wonder if its possible to make a version that could change the hrefs to the fallback page so i wont get like the 404 error and fetched data thro the fallback (client side)

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

No branches or pull requests

2 participants