balatvm / redux-breakpoint

5 stars 1 forks source link

Uncaught TypeError: Cannot read property 'width' of undefined #1

Closed RobsonAraujo closed 5 years ago

RobsonAraujo commented 7 years ago

Hei there, first, thanks for making this library.

We have a problem on resize, it gives the following error:

Uncaught TypeError: Cannot read property 'width' of undefined at onResize (index.js?fd5c:27) at eval (debouncer.js?69e4:13) onResize @ index.js?fd5c:27 (anonymous) @ debouncer.js?69e4:13

Any idea what could be the cause?

Tested on chrome with the following package.json:

"dependencies": { "axios": "^0.16.2", "babel-core": "^6.26.0", "babel-eslint": "^7.2.3", "babel-loader": "^7.1.2", "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", "babel-plugin-transform-es3-property-literals": "^6.22.0", "babel-polyfill": "^6.26.0", "babel-preset-babili": "^0.1.3", "babel-preset-env": "^1.6.0", "babel-preset-react": "^6.24.1", "cron": "^1.2.1", "exports-loader": "^0.6.4", "express": "^4.15.4", "html-entities": "^1.2.1", "http-proxy-middleware": "^0.17.4", "jquery": "^3.2.1", "memory-cache": "^0.2.0", "moment": "^2.18.1", "popper.js": "^1.12.5", "react": "^15.5.4", "react-dom": "^15.5.4", "react-hot-loader": "^3.0.0-beta.7", "react-load-script": "0.0.6", "react-player": "^0.20.0", "react-rangeslider": "^2.0.1", "react-redux": "^5.0.6", "react-router": "^4.2.0", "react-router-dom": "^4.2.2", "react-slick": "^0.14.11", "redux": "^3.7.2", "redux-breakpoint": "^3.0.6", "redux-devtools-extension": "^2.13.2", "redux-immutable": "^4.0.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.2.0", "slick-carousel": "^1.7.1", "string": "^3.3.3", "striptags": "^3.1.0", "tether": "^1.4.0", "winston": "^2.3.1" }, "devDependencies": { "better-npm-run": "0.0.15", "bootstrap": "^4.0.0-beta", "classnames": "^2.2.5", "concurrently": "^3.5.0", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.28.7", "es5-shim": "^4.5.9", "es5to3-webpack-plugin": "^1.0.0", "es6-math": "^1.0.0", "es6-promise": "^4.1.0", "eslint": "^3.19.0", "eslint-loader": "^1.9.0", "eslint-plugin-babel": "^4.1.2", "eslint-plugin-compat": "^1.0.2", "eslint-plugin-jsx-a11y": "^5.1.1", "eslint-plugin-react": "^7.3.0", "extract-text-webpack-plugin": "^2.1.0", "file-loader": "^0.11.1", "font-awesome": "^4.7.0", "immutable": "^3.8.1", "mdbootstrap": "^4.4.1", "mediaelement": "^4.2.5", "node-sass": "^4.5.3", "object-hash": "^1.1.8", "piping": "^1.0.0-rc.4", "postcss": "^6.0.10", "postcss-cssnext": "^2.11.0", "postcss-loader": "^2.0.5", "prop-types": "^15.5.10", "redux-immutable-state-invariant": "^2.0.0", "resolve-url-loader": "^2.0.2", "sass-loader": "^6.0.5", "store": "^2.0.4", "style-loader": "^0.18.0", "stylelint": "^7.13.0", "stylelint-config-standard": "^16.0.0", "stylelint-csstree-validator": "^1.2.0", "stylelint-no-unsupported-browser-features": "^1.0.0", "trunc-text": "^1.0.2", "url-loader": "^0.5.8", "webpack": "^3.5.5", "webpack-dev-server": "^2.7.1", "whatwg-fetch": "^2.0.3" }

Thanks in advance!

balatvm commented 6 years ago

Hi RobsonAraujo,

Sorry for the late reply. I hope you found the solution by now. This issue happens if we miss to add breakpoint reducer while creating store reference.

import syncBreakpointWithStore, {breakpointReducer} from 'redux-breakpoint'
const store = createStore(
  combineReducers({
    ...reducers,
    breakpoint: breakpointReducer
  })
)

I couldn't reproduce this issue in any other way. Hope it helps.. And thanks for your feedback 👍