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

How to provide fetch function to storyblok? #279

Open
enyo opened this issue Nov 13, 2022 · 3 comments
Open

How to provide fetch function to storyblok? #279

enyo opened this issue Nov 13, 2022 · 3 comments

Comments

@enyo
Copy link

enyo commented Nov 13, 2022

The way SvelteKit does hydration is by caching the result of any fetch call. There is no obvious way to provide this fetch function to the apiPlugin.

Please either add the possibility to do so, or document it. (This will also result in less http requests hitting your servers).

@josefineschaefer
Copy link
Collaborator

We will investigate the options provided from storyblok/js and keep you posted, thank you for your patience.

@Radiergummi
Copy link

Hasn't this actually been solved in the meantime? From what I can see, the possibility to provide a fetch implementation as an option has been added in storyblock-js-client 5.2.0 (Dec 19, 2022):
https://github.com/storyblok/storyblok-js-client/releases/tag/v5.2.0

@Narigo
Copy link

Narigo commented Feb 14, 2024

What @Radiergummi says is true, that there is an option to provide a custom fetch function now. But this seems to be buggy (at some point they used await fetch instead of await this.fetch. I can see that version 6.6.7 of storyblok-js-client contains a bugfix for this exact problem. Since @storyblok/svelte uses @storyblok/js@^3.0.6 as a regular dependency and that in turn uses storyblok-js-client@^6.6.3 as a regular dependency, the bug fix seems to not be included yet. As far as I understand it, @storyblok/js needs to cut another release with the latest version of storyblok-js-client and @storyblok/svelte needs to do a release with that new release of @storyblok/js then.

Not sure if these dependencies should be marked as peer dependencies as you'd have to install them manually then, but at least we could have all fixes right away...? 😕

Is there some automated release process which takes care of this? I'm trying to figure out whether I need to create a patch for myself or whether I can wait for a release to happen 😅

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

4 participants