« first day (3891 days earlier)      last day (1049 days later) » 

DRP
1:56 AM
Ok I'm trying this Context example but using Hooks, Button changes from Ligth to Black but never toggles back.

theme-context.js

import React from 'react';
export const themes = {
    light: {
      foreground: '#000000',
      background: '#eeeeee',
    },
    dark: {
      foreground: '#ffffff',
      background: '#222222',
    },
  };

  export const ThemeContext = React.createContext({
    theme:themes.dark, // default value
    toggleTheme: () => {},
  });

theme-toggler-button.js

import React from 'react';
    I thought this was the problem:

    const toggleTheme = () => {
           console.log("ThemeApp:toggleTheme");
           setThemeState({
            ...themeState,
            theme:
              (themeState.theme === themes.dark)
                ? themes.light
                : themes.dark
           })
        }

Show condition does reflect TRUE when it has changed.
Show state shows it being the same. So basically the state is not changing, hence I go and check the debug Components on Chrome tab:
 
@DRP Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
DRP
This is prior hitting toggle:
After hitting toggle:
Right there so far so good. So basically:

-The problem does not seem in the condition that sets the state.
-The object is accessed properly as it does toggle right the first time
-Not sure why it's not flipping a second time
-I can certainly see that the toggleTheme property is there
-The console.log does show output everytime I hit the toggle button

So what else could I try to triage this matter?
This is the capture each time I try to toggle:

theme-app.js:8 ThemeApp:toggleTheme
20:09:30.962 theme-app.js:8 ThemeApp:toggleTheme
20:09:33.931 theme-app.js:8 ThemeApp:toggleTheme
The example is pretty much the same as: https://reactjs.org/docs/context.html ON the part that says Updating Context from a Nested Component

The main difference is that the App is class and not hook
So if I had to think on where to further debug is exactly on that toggleTheme function
It has definitely to be something basic... back in the day in the office there was pure silence, and there was this guy Moreno who would burst out of nowhere to shout BASICCCCCCCCCCCCCCSSSSS! Kinda an Eureka time lol
Just let that sink and picture it X) I hope you find it funny as I did
 
 
2 hours later…
gig
4:47 AM
Hi Everyone need some help in react js
I am having an input field and dropdown select box
<input name="name" type="text" size="30" placeholder="Name" >
I want to validate(make it mandatory) this input filed if value=1 this value will be coming in my code above
could you plz help me if you dont mind
 
 
2 hours later…
gig
7:13 AM
can anyone say is it correct or not
<input name="name" type="text" size="30" placeholder="Name" validate={required,this.value==1} >
can we write like this in react
 
 
2 hours later…
9:14 AM
Consider the line let person = (name = "John Doe", address = "Somewhere"); What data type is defined for person variable? if is typed console.log(typeof person) is returned String.
 
9:31 AM
person will have the value Somewhere which is a string. You've also created two global variables, name and address.
I believe you mean to write let person = { name: "John Doe", address: "Somewhere" }
 
9:53 AM
Thanks
 
10:28 AM
@gig do we have a attribute validate...
<input name="name" type="text" size="30" placeholder="Name" value={this.state.required == 1 ? 'ASSIGN_YOUR_VALUE' : 'ASSIGN_YOUR_VALUE_FOR_ELSE_CASE'} />
 
In angular i have an api call that set cookies but the cookies are not available immediately .. any help?
 
@GpSidhu Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
@GpSidhu SET TIME OUT
AND do call
a delay timer
 
i have already placed a 2 second delay but still some users are getting the issue. is there any proper way to know when the cookies are ready
 
@GpSidhu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
10:35 AM
this.api.post('front/register', this.registerForm.value)
      .subscribe((res: any) => {
        this.auth.setUser(res);
        // send to phone and email verification page
        setTimeout(() => {
          this.loader.hide();
          this.router.navigate([VerifyEmailPhoneComponent.VERIFY_PHONE_EMAIL_URL]);
        }, 2000); // adding delay to redirection
      }, err => {
        this.loader.hide();
        if (err.status === 422) {
          lodash.each(err.errors, (value, key) => {
            this.serverErrors = [...this.serverErrors, ...value];
 
1 message moved to Trash can
 
try with a promise.prototype.then
 
11:35 AM
@Cerbrus - personally dont like PHP because, since it has a bad design by technology perspective... or whatever reasons... i wasn't aware of when i chose to become a coder... later i realised non of the big corporate companies requires coders for it. because most java or dot net guys can do coding in PHP easily. nevertheless, i will not deny that i had few years enjoyed coding in PHP
whereas, it puts me in surprise when i read facebook was built using PHP at it's start. big e-Commerce solutions still use magento like frameworks and 25% of web is covered by wordpress (again a PHP thing)
 
Mate, don't ping someone to reply to a chat message that's 2.5 months old.
 
@Cerbrus sorry about that but stackoverflow shows it's a favourite now...
i will delete it
i couldnt delete the previous
if you can please delete it
replying is a choice
have a great day
bye!
 
I see it's still in the starred messages
No point in deleting your reply, I already got notified. Please keep the timestamps in mind tho
 
12:26 PM
Good afternoon, I'm looking for help with a signature verification issue related to this post : stackoverflow.com/questions/67936907/…
 
@killer_minet Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
1 hour later…
gig
1:48 PM
@CommonMan actually there is no else case I am having dropdown element at top with 1,2,3,4 as dropdown values those will be stored in this.props.value so
 
could you please post it in codepen.io
or jsfiddle
so that it will be easier for me to help you
codepen . is easier and nicer to use react
 
gig
I was just using this scenario in my case my case is different and cant reproduce it in codepen could you plz give idea if you dont mind
Have an dropdown element first and then an input field the dropdown selected value storing in this.props.value if this value=1 the input field should be required that is the case which I am working for
 
2:07 PM
I have a bit of TypeScript code that's trying to hit an API endpoint. It's getting a 401 error, which I'm expecting, but I'm trying to catch the error and that's failing. I've tried both a try/catch block and a catch() function, but nether one gets called.
This is the function
function* patchHeartbeatSaga() {
    yield putRequest(Api.putHeartbeat, {})
        .then(resp => {
            console.log(resp);
        }).catch(function* (err) {
            yield put({ type: LoginConstants.putHeartbeatFailure, data: err.response });
        })
}
 
gig
I tried like this but not able to get <input name="name" type="text" size="30" placeholder="Name" validate={required,this.value==1} >
@CommonMan
 
what is the required doing there
what it is
 
gig
Just tried that syntax but I think wrong it should validate if this.value==1
@CommonMan
 
<input name="name" type="text" size="30" placeholder="Name" validate={this.state.value==1} >
@gig what validate denotes?
what required is
input will be in render
so if the value has to reflect the change it has to be accessed thru this.state
and inside constructor
you should have this.state = {value: 5};
 this.state = {value: 5};
 
@CommonMan Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
2:16 PM
constructor(props){
super(props);
this.state = {value: 5};
}
 
1 message moved to Trash can
 
and then you can access value anywhere inside the class by using this.state.value
 
gig
Why we shld give value:5 in constructor? @CommonMan
 
thats your choice for initial value or fall back value
you can even give null or empty
it's upto your choice or requirement
 
gig
So if i select 2 in dropdown then the input should not be mandatory will your idea works @CommonMan
 
2:22 PM
post your select dropdown
are you trying to do a drop down toggling for the drop down chosen value
you are expecting the input value to be changed ?
is that your requirement
 
gig
Yes the selected dropdown value is storing in this.props.value
 
Hi all. Anyone familiar with CSP here?
 
likely
 
drop down is in a different component, its why you are getting it from props
?
 
gig
2:37 PM
Yes @CommonMan
 
<input name="name" type="text" size="30" placeholder="Name" value={this.props.dropdownvalue==1 ? 1 : this.state.inputvalue}  />
 
gig
Why dropdownvalue and inputvalue not understood ok will try once @CommonMan
 
DRP
Why is it not allowed to delete messages here?
I mean after x time
In that case flagging for moderator would be equivalent?
 
2:58 PM
we can move stuff to the trash can for you, but otherwise everything stays for historical purposes
(even the trash can)
 
DRP
is trash can ever purged?
 
no
 
Happy Friday
 
DRP
Cheers!
 
You have a few seconds to delete an item after posting it (though room owners can view its history)
So nothing is ever truly deleted once posted
 
3:17 PM
unless a mod deletes it
Things that are sensitive in nature can be stripped from the history
 
DRP
Sounds good, thanks for the clarification
btw Udemy courses for existing members are over the roof!
pre-pandemic ~$10, currently ~$99
 
scam
 
hi guys!
 
@RafaelPuerta Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
o/
 
3:30 PM
@KevinB Forgot about that
 
DRP
3:43 PM
So regarding yesterdays issue, I thought the best way to continue triaging was to actually test the state locally, and surelly this button does toggle back and forth, hence the problem seems with the Context Consumer
yes it does toggle the Toggle Theme button as well back to light theme, but the behavior remains on it of only going dark to light
 
In React, is it possible to change the route from a Redux method? And if so, would it be considered inadvisable?
 
DRP
Ok I have now added the check mark for :Highlight updates when components render
It does render the full box with either button. hmmmmm
 
4:35 PM
Does anyone know how to get click/touchstart events to trigger in Chrome's dev tools when in the tablet view?
 
 
1 hour later…
5:39 PM
I am so out of it today. I just tried to google something in this chat...
 
6:06 PM
> html form page
 
 
1 hour later…
7:30 PM
Anyone know if VSC has a version control over documents?
 
7:44 PM
wdym
it does have git support ofc,
 
I'm aware of the git PUSH/Pull. I was just curious if VSC itself saved old versions everytime you update something
 
not tmk
 
Figured
https://jsfiddle.net/BeerusDev/ke4y9Lh7/6/

How can I get this to display without having to click the button, I tried removing that functionality and it displayed nothing. Also, any clue why the form-control input-lg class isn't working?
 
8:00 PM
without clicking feedback?
 
I Want to remove the button overall and just have the bootstrap form display on the page on load
I am guessing it is because it is in a modal
 
i mean
you can just run the function,
and the modal will pop up
(after it exists in the dom ofc)
 
Fixed it.
Sike
Works in fiddle but not my live server
 
8:16 PM
probably for the same reason your submit event binding is in the dom ready callback.
 
 
1 hour later…
9:41 PM
!!javelin or spider
 
spider
 

« first day (3891 days earlier)      last day (1049 days later) »