Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Christopher McCormack
@cmccormack
@gianpaolodatu I think flexbox is a fairly simple way of making much nicer layout with minimal config
you can still use queries though
Chris Tram
@ctram
Hey all, I want to use fetch() to make a request to a server; the server then responds with a 302 redirect to another path with the same origin, so no CORS. From what I've read, I would expect the browser to follow the redirect but that is not what I have been experiencing. Instead, the browser is receiving redirect and it makes a GET request to the redirect location and receives the correct response (in this case, HTML), but the browser does not update the DOM, any suggestions?
So to clarify, I suppose the browser is acting as expected, it does follow the redirect, but my problem is that the browser does NOT update the DOM with the last response it receives.
More info: If you manually navigate to the path that will respond with a redirect, the browser will follow the redirect and update the DOM as expected. The issue here is when I am trying to follow a direct via fetch(). I have a button that will trigger a fetch() upon it being clicked.
Stephen James
@sjames1958gm
@ctram What is your code doing with the fetch response? When you use fetch your code has to process the response
Chris Tram
@ctram
function redirect() {
    const headers = new Headers();
    headers.append('Accept', 'text/html');
    fetch('http://localhost:3000/say', { headers}).then(res => {
      return res.text();
    }).then(body => {
      debugger
    })
  }
@sjames1958gm
Stephen James
@sjames1958gm
The parameter to the then will contain the data from the file, if you want it to go into the DOM you will need to put it there yourself
J. Guidry
@J-Guidry

For those who know React, I have a simon game I've been making with Reactjs. I have a boolean to disable clicking when a sequence is playing but it doesn't work. I used sourcemaps and React dev tools on Chrome in my local repo to try to find the problem, but the best I could do is seeing that the boolean toggling is happening when I set breakpoints but it is not reflected in react dev tools and buttons are still clickable. Aside from that, the app works if you don't click during a sequence and you don't double click a color. I haven't done the strict button or created the win condition yet for winning 20 turns.

I have a glitch repo with the code and a gist with the steps/psueudocode. I have been working on this for a while. I appreciate any help.
https://gist.github.com/J-Guidry/55422112c2e62b0ef3b389d91b90681e
https://glitch.com/edit/#!/reactjs-simongame

Christopher McCormack
@cmccormack
@J-Guidry is this your toggle?
toggleClickable(){
        this.setState({clickable: this.state.clickable = !this.state.clickable});
    }
It would make more sense for you to not use a toggle function if you are trying to specifically set it to clickable or not
Also you don't want to try and store a value in state, that's what setState is for in the first place.
toggleClickable() {
    this.setState( prevState => ({
        clickable: !prevState.clickable,
    }));
 }
J. Guidry
@J-Guidry

I tried both

this.state.clickable = !this.state.clickable

and

!prevState.clickable
The 2nd one will toggle it to false when it is my turn to click on the 2nd turn
I will make that change now on the glitch
Christopher McCormack
@cmccormack
@J-Guidry you should never be using this.state.clickable = !this.state.clickable
setState is to set state
might behoove you to add a boolean parameter to your toggleClickable so you can pass a boolean value that you want to specifically set, for any scenario you want to update the clickable state but want it set a specific way
J. Guidry
@J-Guidry
@cmccormack If I set a parameter, how would I use it in set state? As a third argument? I think that was a callback function if I remember right
Looks like the start button creates errors saying clickable is undefined when the change was made
SN
@SNoon85_twitter
Hi All, curious how to get animations that you can make in After Effects over into an app. Like how do advanced animations carry over to programming? Example: https://cdn.dribbble.com/users/32512/screenshots/4034207/natural_mobile_dribbble25.gif
I can make these in After Effects, but Im a newbie and I am having a hard time understanding how you could incorporate these into an app, like an AI voice app. Many thanks!
Christopher McCormack
@cmccormack
@J-Guidry you can just do something like
toggleClickable(set) {
    this.setState( prevState => ({
        clickable: set || !prevState.clickable,
    }));
 }
probably want a better name than that
J. Guidry
@J-Guidry
@cmccormack Trying it now
Christopher McCormack
@cmccormack
@SNoon85_twitter Do you want these to be clickable or just animations?
SN
@SNoon85_twitter
It would just be animations of the AI talking
obviously "reactive animations" to the sound waves of the voice when answering a question. Similar to Siri
Christopher McCormack
@cmccormack
Does after effects have a web api?
SN
@SNoon85_twitter
Im not sure actually, I will look into that. I dont think so
Christopher McCormack
@cmccormack
I have no idea how this would be done, btw. I imagine you would need something to take input to produce the animated output. This looks complex, so I imagine it would be a library you would have to import
J. Guidry
@J-Guidry
@cmccormack no good. clickable still false/disabled at 2nd turn
Christopher McCormack
@cmccormack
@J-Guidry I wasn't really answering how to fix that problem, just pointing out flaws in your function
J. Guidry
@J-Guidry
Perhaps I need to rethink the logic somewhere or place the toggleClickable call elsewhere
SN
@SNoon85_twitter
this is what I found "https://www.adobe.io/apis/creativecloud/aftereffects.html" so maybe it is possible via API.
Christopher McCormack
@cmccormack
@J-Guidry yes I was going to suggest exactly that
follow your logic and see where it's failing. log what the state is and what you think it should be and compare
SN
@SNoon85_twitter
Thanks @cmccormack for suggestion, this should yield something!
Christopher McCormack
@cmccormack
@SNoon85_twitter good luck
SN
@SNoon85_twitter
thank you!
Christopher McCormack
@cmccormack
Chris Tram
@ctram

@sjames1958gm

The parameter to the then will contain the data from the file, if you want it to go into the DOM you will need to put it there yourself

How do you make it go to the DOM? directly manipulating document?

SN
@SNoon85_twitter
@cmccormack perfect, will check that out also.
Chris Tram
@ctram
@sjames1958gm Thanks! So it is incorrect to expect the browser to automatically update the DOM when receiving a 302 redirect response via a fetch() ?
Stephen James
@sjames1958gm
Yes when you use fetch you are asking for the data to be provided to your JavaScript code
Chris Tram
@ctram
@sjames1958gm Great, thanks for the help!
Morchid Chellali
@Morched23MJ
I can submit a Github repo instead of a pen? In this case, I'm making a portfolio, and I want to seperate the CSS of each part, for a better maintenance. :P