Comments (6)
Presumably there is a reference to window somewhere before componentDidMount(). I haven't had much exposure to next.js so will try to repro the setup.
from react-spaces.
I had to do this to work hmm
const ViewPort = dynamic(
// @ts-ignore
() => import("react-spaces").then(mod => mod.ViewPort),
{ ssr: false }
);
const LeftResizable = dynamic(
// @ts-ignore
() => import("react-spaces").then(mod => mod.LeftResizable),
{ ssr: false }
);
const RightResizable = dynamic(
// @ts-ignore
() => import("react-spaces").then(mod => mod.RightResizable),
{ ssr: false }
);
const Demo = () => (
<ViewPort>
<LeftResizable size="25%" trackSize={true} style={grayStyle}>
hi
</LeftResizable>
<RightResizable size="25%" trackSize={true} style={grayStyle}>
hi
</RightResizable>
</ViewPort>
);
const grayStyle = { backgroundColor: "#eee" };
from react-spaces.
I've pinpointed this down to the bundling and specifically the bundling of SCSS which breaks the components when doing SSR (it's currently using style-loader re this issue webpack-contrib/style-loader#109). I am revising the bundling to use rollup instead of webpack and also revising the way the styling is applied to the components which should fix this issue. Hopefully this will be ready for release in the next version.
from react-spaces.
@zifahm I've released version 0.1.14 now which has some changes into how the library is bundled and more specifically how styling is added to the page which should allow you to use the components without your workaround above. Let me know if this works for you. It does however exhibit the standard late style load behaviour when a page is first displayed due to the styling only being injected on to the page when the javascript has been fully loaded.
Due to the benefits of having a layout library working with SSR I am working on a server-side specific bundle which in intended to be used with SSR specific applications. You can currently try using this by importing 'react-spaces/dist/server' instead of 'react-spaces' and also importing 'react-spaces/dist/server.css' by using @zeit/next-css. It's currently experimental though and has some placement problems at the moment but you can check out a test app here - https://github.com/aeagle/react-spaces/tree/master/nextjsdemo
from react-spaces.
@aeagle sure thanks. Ill let you know if i am incurring any problems.
from react-spaces.
I'll close this now. I can reopen if you are still having problems.
from react-spaces.
Related Issues (20)
- Dynamic minimum and maximum size when resizing does not work HOT 3
- <Fill/> width can exceed <ViewPort/> width HOT 3
- dynamic calc miscalculation HOT 12
- add sourcecode to lorem-ipsum demo HOT 1
- Trying to resize panel throws `getBoundingClientRect` error HOT 4
- bug: resizeType always is "resize-right" HOT 1
- bug: how to judge "LeftResizable" drag's direction? HOT 1
- Corner resize handles HOT 3
- Opposite edge resizing (left/right or top/bottom)
- Attempted import error: 'unstable_useOpaqueIdentifier' is not exported from 'react' HOT 2
- Auto scroll not working while dragging using react-beautiful-dnd HOT 1
- Styles not working as expected HOT 2
- handleSize seems to be ignored on Custom spaces, always 5px HOT 3
- SSR on 0.2.0: ReferenceError: document is not defined HOT 8
- `onResizeEnd` doesn't respect `maximumSize` if `size` === `maximumSize` HOT 1
- Is it possible to have a minimum size fill HOT 1
- Allow 'as' property to be Polymorphic (to play with libraries like Framer Motion) HOT 8
- Update peer dependencies for react to include v17 HOT 4
- Allow grid/snap points to be specified on a resizable space to constrain resizes
- Customize Handles HOT 7
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 react-spaces.