Comments (8)
@Jwhiles sorry for silence.
It's very simple. I have ecommerce in next.js and want to quickly create custom Contentful extension. The easiest way for me to do this is to create new page in my next app (/__contentful-field-extension
) - this page will be Contentful extension. Setting up totally separate environment only for the purpose of small Contentful extension is annoying.
Frameworks like next.js are "SSR-first" and you can't prevent next from doing SSR. And it doesn't apply only to next, it applies to most modern next-like frameworks (Gatsby, nuxt).
The fix is super simple, you must assume that window
can be undefined and let the app build. If window
is undefined you can assume you're on the server and you can do "nothing". It would help a lot.
from ui-extensions-sdk.
@andipaetzold @Jwhiles
I too am hitting the same issue and I feel that it should be fixed on contentfuls side and not force the break of SSR.
Otherwise you're forcing the issue over to developers to apply the same work around again and again, when it could be simply fixed where the problem actually arises.
As @r00dY points out, it would really help out a lot!
Many thanks
from ui-extensions-sdk.
@r00dY can you explain what you would expect to happen in the case where there is no window is accessible? Fundamentally the purpose of this library is to allow the transfer of data from the Contentful User Interface into an iframe and back again. And as a result it's not clear to me what the use case is for calling the init method in an SSR context.
from ui-extensions-sdk.
Closing because of inactivity. Feel free to reopen if you are still running into issues.
from ui-extensions-sdk.
@Jwhiles it could just do nothing, or bail - this only ever happens on server for SSR (not applicable for a Contentful Extension of course, but in my case and many others I suspect, the extension lives on a server used for the frontend as well.
I'm not super familiar with how the sdk works - but I can't run it at all on this Next.js project because simply importing it causes it to fail completely
from ui-extensions-sdk.
Hey folks,
this issue has been resolved with our latest release (v4.8.1). When importing the App SDK, window
should not be used anymore and youshouldn't see any error in Node. Please reopen this ticket if you are running into the same problem.
from ui-extensions-sdk.
@andipaetzold appreciate this, thank you! 💪
from ui-extensions-sdk.
@r00dY did this change work for you? I am waiting for some positive feedback before shipping this to everyone as it changes some internal flows.
from ui-extensions-sdk.
Related Issues (20)
- `init` doesn't work when called too late HOT 7
- Metadata (tags) changes are not reflected in the editor HOT 1
- Frontend URL availability HOT 2
- Conditional Field Rendering HOT 3
- Contentful Management : Entry's references method not working
- Change LocaleSettings for the Entry HOT 1
- `onMetadataChanged` not called in Compose view HOT 3
- Passing data to opened dialog app. HOT 1
- incorrect version from navigator.openEntry HOT 3
- Links/References all have the type `Link` which makes them not distinguishable HOT 5
- Additional filters for dialogs.selectSingleEntry HOT 2
- Add margin option to auto resizer HOT 4
- Can I fetch all available locales with App SDK?
- dialogs.openAlert() but without any buttons
- SDK method to set field focused state
- Field iframe outset margin + padding
- Entry editor app in bulk editor needs to access useAutoResizer HOT 4
- field.onValueChanged does not trigger for non-default locales HOT 1
- Include defaultValue in field and contentType typings HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-extensions-sdk.