-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Dynamic SSR/PWA #10215
Comments
I recently built a Capacitor app + PWA from the same code base, you can read a blog post about the architecture here. I did not use SSR because it was not necessary for my use case, but there is nothing to prevent you from that. There is already a switch, set:
...in your |
@khromov thanks for the reply, I'm reading the blog. Yes indeed we have made cap svelte PWAs apps before. But we want SSR for web/performance/seo reasons while maintaining the same code-base for PWA, so the best of both worlds. The issue with the pre-script is, how do the +server scripts work? |
@khromov I noticed you're not using platform native transitions, I tried to swipe back and couldn't in your app, you can do this easily in Capacitor, any reason why? |
+server.ts files are stripped from the output if you compile with
I'm not familiar with this, is it a plugin or something in Capacitor core? You can send a link and I'll check it out. |
@khromov capacitor includes native page transitions with a custom view controller: https://capacitorjs.com/docs/ios/viewcontroller. It doesn't work on simulator only real device. Yes I saw that in your post Is the code then exported an executed a layer above in static JS for example? |
@khromov you can use this code to make it feel more 'native' ionic-team/capacitor#1097 (comment) |
@ollyde If you set |
@khromov yes but what do you mean by executed. Do you mean server.ts will be run on the client before the page is displayed allowing data to be passed to it? If that is the case how do we show loading indicators on the client then? |
@ollyde Server endpoints are never executed on the client. In the context of For example if you had |
@khromov oh that's a shame, hence why this ticket exists. Would be nice to have +server.ts converted to some client-side caller with loading indicator options. Of course not all +server files can do this, but My quest is to get SSR working on hosted platforms and PWA working for apps without any configuration :D |
It would be helpful if you specified how you would imagine it to work, for example, what files would be created, how would the code look (provide a "pseudo-code" example), and what would the output be like + a pipeline of how the data flow. As for your last message, "client-side caller with loading indicator options" is exactly what a |
@khromov the +page::load function only runs on the client to make requests no? Unless I missing something out here. |
@ollyde +page load is called "universal" and also runs on the server, please see: |
So the PWA can also use page load, but then how do indicators and the like work? For example if I use an infinite double way list? |
You have to build your own loading indicator, you can do this for example using If you prefer to do the load state in your component, you can use streaming promises: All of this works with adapter-static. You might like the official Svelte Discord channel, it's better suited for open-ended discussion: |
@khromov thanks for this info. Going to give this a try. |
It seems like I am describing the same "Dynamic SSR/PWA" issue in #10332, but the discussion is much better. I also made a repo to reproduce the issue I'm having at https://github.com/NatoBoram/bug-report-sveltekit-ssr-csr |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the problem
I have a SvelteKit app, working great.
I want to be able to export the app to Capacitor, so need static assets and code.
Would be the most awesome kick-ass thing ever if I could have two build settings.
And would be super-mega-awesome if this could switch automatically and the code would magically work.
Describe the proposed solution
Enable a switch to allow SSR apps to create static assets for PWAs without changing code.
Alternatives considered
:*-(
Flutter..
Importance
would make my life easier
Additional Information
Making this feature work will bring us into a new dimension for development.
No response
The text was updated successfully, but these errors were encountered: