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

Problem window is not defined #15

Closed
fritzZz opened this issue Aug 7, 2017 · 13 comments
Closed

Problem window is not defined #15

fritzZz opened this issue Aug 7, 2017 · 13 comments

Comments

@fritzZz
Copy link

fritzZz commented Aug 7, 2017

When I try to add your library to my project I get this error:

] [dev:server] /home/blablabla/demo/node_modules/react-trello/dist/components/Board.js:33 [2] var store = (0, _redux.createStore)(_BoardReducer2.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); [2] ^ [2] ReferenceError: window is not defined [2] at Object.<anonymous> (/home/blablabla/demo/node_modules/react-trello/dist/components/Board.js:33:61) [2] at Module._compile (module.js:570:32) [2] at Object.Module._extensions..js (module.js:579:10) [2] at Module.load (module.js:487:32) [2] at tryModuleLoad (module.js:446:12) [2] at Function.Module._load (module.js:438:3) [2] at Module.require (module.js:497:17) [2] at require (internal/module.js:20:19) [2] at Object.<anonymous> (/home/blablabla/demo/node_modules/react-trello/dist/index.js:8:14) [2] at Module._compile (module.js:570:32)
How can I solve this issue? I saw an other issue closed but the problem already exists.
I'm using the version "react-trello":"^1.18.1"-

I've seen that you define also a store (redux) for your library? How can I use my redux store instead of your?

Thank you!

@rcdexta
Copy link
Owner

rcdexta commented Aug 10, 2017

I found a place where window is referenced loosely. v1.18.2 should fix it. Can you try again?

Right now, react-trello does not support injecting an external store. But it should be possible to dynamically add reducers to an existing store as discussed here: https://stackoverflow.com/questions/32968016/how-to-dynamically-load-reducers-for-code-splitting-in-a-redux-application

Pls feel free to make that change and submit a PR. Else will try to incorporate this feature sometime

@fritzZz
Copy link
Author

fritzZz commented Aug 10, 2017

Thank you for your answer!
I tried also with the version v1.18.2 and I have the same problem.
Thank you for your suggestions also, I will try when the module will correctly work in my project.

@rcdexta
Copy link
Owner

rcdexta commented Aug 10, 2017

Sorry again! can you check with v1.18.3

@fritzZz
Copy link
Author

fritzZz commented Aug 10, 2017

I found your fix but in my node_modules in the dist version of the react-trello library in my project I found this in the Board.js file
var store = (0, _redux.createStore)(_BoardReducer2.default, window && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
And the version is v1.18.2 in package.json
"raw": "react-trello@^1.18.2", "scope": null, "escapedName": "react-trello", "name": "react-trello", "rawSpec": "^1.18.2", "spec": ">=1.18.2 <2.0.0", "type": "range"

The problem occurs when I start webpack with my project in my local environment.

@rcdexta
Copy link
Owner

rcdexta commented Aug 10, 2017

yes i think you have frozen the package version to 1.18.2. Can you bump it to 1.18.3

@fritzZz
Copy link
Author

fritzZz commented Aug 10, 2017

Ok! Thank you! Everything is working well now!!

I'm testing your Board and seems that custom cards have this 3 different "strange" type of problems:

  • loose dragging when I pass on top of other cards and immediatly it starts again the dragging but replace with the card that was below
  • get this kind of errors when I drag one card on top of the cards of another Lane and get strange beahaviours like duplicate empty slots when I drag or impossible to drugOut something and no empty slot appear.
    Warning: flattenChildren(...): Encountered two children with the same key, Card21. Child keys must be unique; when two children share a key, only the first child will be used.
    Uncaught TypeError: Cannot read property 'id' of undefined at http://localhost:8079/assets/js/app.js:92940:21 at Array.map (native) at Lane._this.renderDragContainer (http://localhost:8079/assets/js/app.js:92938:76) at Lane.render (http://localhost:8079/assets/js/app.js:93026:15)
  • One time I've lost one card (at the beginning cards were 4 but I ended with 3 cards)

Browser is Google Chrome Version 59.0.3071.115 (Official Build) (64-bit)

It also happens on your sample https://rcdexta.github.io/react-trello/?selectedKind=react-trello&selectedStory=Drag-n-Drop&full=0&down=0&left=1&panelRight=0
on firefox and chrome.

@rcdexta
Copy link
Owner

rcdexta commented Aug 14, 2017

@fritzZz Thanks for pointing out the issues with custom cards. I think the drag-n-drop feature is buggy when the card has custom template. Working on it.. will keep you posted

@fritzZz
Copy link
Author

fritzZz commented Aug 17, 2017

I really want to use your component in my project so if you can "try" to give me more information about the progress of you bugfix I would be greatful!
I really don't want to push you too hard, I'm sorry!
Thank you in advance

@rcdexta
Copy link
Owner

rcdexta commented Aug 19, 2017

Hey @fritzZz. I am working on this issue this weekend and will be able to push something out by monday..

@rcdexta
Copy link
Owner

rcdexta commented Aug 20, 2017

Have rewritten most of the drag-n-drop logic to handle multiple cases. One know issue now is when you move a card from one lane to another, it will always be added to the end. That might be fixed in future. Other issues that you mentioned have been fixed.

You can test drag-n-drop with custom card templates here:
https://rcdexta.github.io/react-trello/?selectedKind=react-trello&selectedStory=Custom%20Card%20styling&full=0&down=0&left=1&panelRight=0

@fritzZz
Copy link
Author

fritzZz commented Aug 21, 2017

Great! I will try it tomorrow!! :)

@fritzZz
Copy link
Author

fritzZz commented Aug 23, 2017

Wow! Great job! It's working fine now!
Thank you very much!

@rcdexta
Copy link
Owner

rcdexta commented Aug 23, 2017

Glad to help. Thanks

@rcdexta rcdexta closed this as completed Aug 23, 2017
reactexp925 added a commit to reactexp925/react-trello that referenced this issue Dec 5, 2019
reactexp925 added a commit to reactexp925/react-trello that referenced this issue Dec 5, 2019
reactexp925 added a commit to reactexp925/react-trello that referenced this issue Dec 5, 2019
pikachunerdy added a commit to pikachunerdy/react-trello that referenced this issue Oct 7, 2022
pikachunerdy added a commit to pikachunerdy/react-trello that referenced this issue Oct 7, 2022
pikachunerdy added a commit to pikachunerdy/react-trello that referenced this issue Oct 7, 2022
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

2 participants