« first day (2881 days earlier)      last day (2083 days later) » 

6:02 PM
@TravisWhite @VishalPachpande Check above screenshot
 
ohhi
 
@TravisWhite @VishalPachpande It is running but doesn't display anything
 
Yeah? Joy? What happens when data is empty array?
 
@KevinB If you know the answer please help many users are finding this difficult to solve
 
// a
const ys = xs.map(x => x.y);
// or b
const ys = xs.map(({ y }) => y);
// or does it not matter as long as you're consistent
 
6:06 PM
Are updates to the state properly propagating to the props?
 
or even more interesting:
 
and is a prop change resulting in a re-render?
 
// c
const ys = xs.map(extract('y'));
 
A rerender is obviously occurring with updated data, if your screenshot from an hour ago is to be trusted
 
@towc, a
 
6:07 PM
Why doesn't it display anything?
 
would be interesting to let arr.map take in a string, to do exactly this. I'm doing this often enough in my code
const ys = xs.map('y');
 
@TravisWhite any reason?
 
yes, i've seen that screenshot
 
short and concise
 
6:08 PM
Why is it not displaying data?
 
@KevinB @VishalPachpande @TravisWhite Above screenshot see the code works fine but nothing is displayed
 
@TravisWhite but it makes you define an extra name, that you need to think about
 
@KevinB In react native it should be wrapped inside <Text>
 
and if you change what you might mean with it, it's going to be hard to make that consistent across the codebase
 
If you put hello world inside teh "", it displays hello world right?
simple debugging steps
Determine what isn't working
 
6:09 PM
@towc usually singular form of whatever you are mapping, not a hard name to come up with
 
@KevinB No it doesn't show hello
 
Then you have another problem unrelated to the data.
Start by getting the demo to work in place of what you have.
 
@stonerock console.dir(this.props.venue); in the render
 
we've already proven that the data exists
on the second render
 
@KevinB Then my question is why did @LuckyKleinschmidt unnecessarily downvoted and @BenFortune told that you should be banned for asking shitty questions. If they themselves can't help then without seeing the issue they assume it to be simple. This is very bad
 
6:12 PM
ahh, so is it not re-rendering?
 
The question isn't good.
You've stated you have a problem, but have no idea what that problem is
other than it doesn't work
 
@stonerock I didn't read original question but it seems you haven't taken very basic debugging steps
 
displaying text on a page is very simple. You get text, put it into the component, and it displays. Much like the image you've provided. You've proven that you have data, and you've put a check in place to handle the initial render that doesn't yet have data. You've proven that on the second render, data exists.
The solution should be as simple as presenting that data
{this.props.path.to.the.data.i.want}
if you can't even get {'hello world'} to display, you've got bigger problems
 
you posted the response data, but could you confirm it is getting to the render properly with the console.dir(this.props.venue); line? Note how many time it outputs
 
It outputs 2 times
 
6:16 PM
Is it possible to wait for a module to finish without having to nest the whole body inside an ".then" ?

require('./database').then( ... *nesting entire file in one big then* ... );

Can it be done in a better way?
 
58 mins ago, by stone rock
user image
on first run it's an empty array, on second it's an object
 
@TravisWhite Check above screenshot
 
I have looked at these answers, but they are all the same with an end result of nesting the entire file in a closure. stackoverflow.com/questions/20238829/…
 
@RyanCameron no, not really
well, i mean, other than async/await
but that's really just doing the same thing
 
That sucks :(
 
6:19 PM
async/await could look prettier than doing it with promises tho, less indentation.
but it doesn't break you out of the async process
 
require(module).then(main);
function main() {
  ...
}
 
@KevinB @TravisWhite I am getting the data i.e Barasti Beach see screenshot below:
 
doesn't look so bad to me
 
It just gets unreadable very quickly if I have to nest a lot of requiring in .then closures
 
6:20 PM
you shouldn't have to nest inside a .then another .then
 
what are you trying to display? It looks like it shows the venue name. Barista Beach? Hard to see with black text on purple
 
^^ LOL
 
api endpoint: api.skips.io/venues
data:
 
You know what, now that I think about, I guess you are right, it won't be that bad. I'll give it a try.
 
{
  "data": [
    {
      "type": "venues",
      "id": "nb",
      "attributes": {
        "name": "Barasti Beach",
        "description": "Barasti Beach is lotacated in the awesome barasti beach",
        "price_range": "$$$",
        "opening_hours": "10:30-12:40/16:00-2:00",
        "organization": {
          "id": "GD",
          "legal_name": "Barasti",
          "brand": "Barasti"
        },
        "place": {
          "address": "Le Meridien Mina Seyahi Beach Resort & Marina, Dubai Marina - Dubai - United Arab Emirates",
 
6:21 PM
@stonerock it's working.
set your background color to white
 
I was squinting at it to make sure nothing was under the photo... and of course it was what it looked like it should've been according to code? So it works eh?
 
ok here is my question
i think i understand what's going on but what may i do abou it
@TravisWhite you helped with this
componentDidMount() {
    if ('serviceWorker' in navigator) {
      // this.aFunction();
      navigator.serviceWorker.ready
      .then(function(registration) {
        console.log('A service worker is active:', registration.active.state);
        // At this point, you can call methods that require an active
        // service worker, like registration.pushManager.subscribe()
        return this.aFunction();
      });
    } else {
      console.log('Service workers are not supported.');
    }
why can't i trigger this.afunction(); from within the .then statement
 
because this isn't what you think it is.
 
@KevinB @TravisWhite Thanks works now
 
i get that... what am i thinking incorrectly?
 
6:26 PM
...
i mean
this changes based on how the function is called and how the function is defiend
The way said function is defined and called, this will not be the component that has aFunction on it.
 
use arrow functions to save scope of parent this
 
i get it doesn't work but why
 
i don't know of another way to explain the why
 
how can i get something from in that .then statement to then trigger something outside of the scope of that
 
other than because that's how it works. You defined an anonymous function and passed it to .then without in any way binding a context to it
 
6:28 PM
is there a way to bind?
 
1 min ago, by Travis White
use arrow functions to save scope of parent this
 
for exacmple if i wrap that navigator function in a function will that be bindable?
 
it would have the same problem
 
darn it... what can i do
 
Holy cow
 
6:29 PM
1 min ago, by Kevin B
1 min ago, by Travis White
use arrow functions to save scope of parent this
lol
 
lol sorry i thought he was talking to the other guy
 
.then(function(registration) {
becomes
.then((registration) => {
 
@TravisWhite can you show me an example of that
ok @TravisWhite what does this do. i write this but perhaps i am missing somethign. why is it different
 
253
Q: Arrow function vs function declaration / expressions: Are they equivalent / exchangeable?

Felix Kling Canonical question If you find a question about issues after replacing a function declaration / expression with an arrow function, please close it as duplicate of this one. Arrow functions in ES2015 provide a more concise syntax. Can I replace all my function declarations / expressions with ...

 
6:32 PM
ok thank you
 
First result for my search, btw
 
"arrow function vs"
i'm lazy with search terms
 
I usually use 'vs'
 
I haven't used visual studio in a while.
 
He just swayed me with his wording, I'll say
vscode4now
baby
 
6:38 PM
@TravisWhite @TravisWhite @BenFortune @LuckyKleinschmidt @VishalPachpande Thank you guys for helping finally solved it with the help of react-devtools for react-native app
 
np, gl
 
@BenjaminGruenbaum Do you know how the bots/crawlers handle websocket connections? As we know, based on Chrome41 they do not support the protocol, but if you transfer all the rendering data over websocket, they initially don't read anything. Question is, do they re-try (for instance, when socket.io falls back to XHR) or not.
So far, any complete SPA I saw which heavily uses WS as transfer-layer performed real bad in SEO stats/Google ranks
 
Hey guys... I'm not sure what terminology I'm after here in js... but I'm sure there's a convenient way (perhaps using jq) to make [{name: 'a', value: 1}, {name: 'b', value: 2}] -> {a: 1, b: 2} ? :p
 
this code. registers a service worker... and upon registering a service worker it will then use the navigator serviceworker.redy function to give an active or activating status
componentDidMount() {
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.ready
      .then((registration) => {
        console.log('A service worker is active:', registration.active.state);
        // At this point, you can call methods that require an active
        // service worker, like registration.pushManager.subscribe()
        this.aFunction();
      });
    } else {
      console.log('Service workers are not supported.');
    }


    this.assetLoader.registerValidSW().then(() => {
the problem is i need the this.assetLoader.registerValidSW().then() => {
to fire off when the service worker is registered
i need the .then(() to take places after the .then(registration)=>
that's my issue
 
6:54 PM
move the this.assetLoader.registerValidSW() call into the function that is called when the SW is ready?
 
@JonClements [{name: 'a', value: 1}, {name: 'b', value: 2}].map(({name, value}) => ({[name]: value}))
(Sorry for double ping) :P
oh you wanted an object lol, reduce it
[{name: 'a', value: 1}, {name: 'b', value: 2}].reduce((a, {name, value}) => {
    a[name] = value;
    return a;
}, {});
 
Thanks... let me have a play with that :)
 
@jAndy do not rely on retries, they sometimes might but they don't always
@BenFortune y u no ...
 
because i'm stupid
 
...
 
7:00 PM
Object.fromEntries(arr.map(o => [o.name, o.value])); // FTFY
 
that looks far too easy and readable though! :)
 
Ok fair it's just a proposal stage 3 though :P github.com/tc39/proposal-object-from-entries
 
Oh, that's a thing?
Awesome
@BenjaminGruenbaum You mean like [{name: 'a', value: 1}, {name: 'b', value: 2}].reduce((a, {name, value}) => ({...a, [name]: value}), {});?
 
@BenFortune yeah exactly
 
hmm
 
7:12 PM
how will it take for built in array methods like flat and flatmap to make it into node now that they are in chrome?
 
@Rick they're in Chrome?
Awesome
Probably 3-4 weeks
 
ya chrome
update your browser manually
 
That'll get me going for the moment - thanks @Ben's :p
 
they even update the window design looks more material like
update version 69, previous version was 68 you can update from the help option in the drop down menu
 
ok here is the exact issue... is there a way for me to subsribe to registration via the sw so the resulting values upon change can activate my return statements?
return navigator.serviceWorker
            .register(this.swUrl)
            .then(registration => {
                console.log('registration hit function q ', registration);
                registration.onupdatefound = () => {
                    const installingWorker = registration.installing;
                    installingWorker.onstatechange = () => {
                        if (installingWorker.state === 'installed') {
                            if (navigator.serviceWorker.controller) {
i get an active null but in the log it isn't null when it resolves.. how can i bind to the resolution
 
7:24 PM
what
so, you're getting 'hit function k ', registration.active logged to the console`
but elsewhere you still see it as null
 
no i'm not even getting hit function k because it is null but it isn't
 
i mean
if it's not going into that if statement
it's null
period
 
no i am trying to subscribe to it so when it isn't null it will run
registration hit function q  ServiceWorkerRegistration {scope: "http://localhost:4000/", active: null, installing: ServiceWorker, navigationPreload: NavigationPreloadManager, sync: SyncManager, â€¦}
see that is q
but really it is this
active: ServiceWorker
onerror: null
onstatechange: Æ’ ()
scriptURL: "http://localhost:4000/service-worker.js"
state: "activated"
 
well, no
at that point in time, it's null.
Some time in the future that may change
 
yes at the point of time it is null
 
7:33 PM
but Right then and there, it's null.
and that's all that matters
 
yes how can i subscribe to the future
settimeout is the only thing i can think of
 
What changes it?
You could use a proxy, but that's a last result given no other options.
setTimeout being not an option at all because it will fail from time to time.
 
i am going to look into service worker messagine
messaging
this seems ridiculous i can't lock on to the active state... jesus
 
basically... read the docs on what you're doing before you try to just make it work.
There are plenty of events/callbacks for you to use to detect when it is ready for you to use.
registration in your code is a developer.mozilla.org/en-US/docs/Web/API/…
 
that one is pretty cool
i am reading this now...
it works now if i could just pass along a return
it would be perfect.
 
8:13 PM
I suspect you're trying to do the impossible
 
8:29 PM
@KevinB I agree, this is rickdiculous
 
8:40 PM
@KevinB if I completely change a question that has no answer is that good or bad in SO
It would basically be a whole new question?
 
that's unacceptable
 
I can't tell if you are being sarcastic?
 
!/s
 
user1596138
@stonerock I saw exactly what was wrong. I spoon fed you the answers and gave you resources to help you fix it yourself in the future. In the end you 1. used my answer and 2. learned to use the devtools in this environment.
 
user1596138
All I have to say is "You're welcome"
 
Knu
8:56 PM
Anyone knows if .json() of Response.body can treat partial data? So for example it could bail out early on the first chunk of data which makes the object invalid.
(granted the data is not compressed)
 
pretty sure it can't.
 
Knu
and you are basing that on…?
 
logic
educated guess
you can go read the source if you want
 
Knu
because it's easier to implement?
 
well, think about it.
 
Knu
8:58 PM
I am reading the spec
that's good enough
 
{"foo": "ba would be a partial json repsonse, right?
 
Knu
yup
 
What should it do with the partial string?
 
Knu
you don't care it's not invalid
 
What if it cut halfway through a key?
 
Knu
8:59 PM
but {"foo": ba
would already be invalid
 
Right
so .json would fail
it wouldn't fix it and give you the json that it did find
 
Knu
yup instead of continuing the download
 
?
 
Knu
nah
just error out
 
the download is done at that point
it would of course fail
thus rejecting the promise
 
Knu
9:00 PM
well it would on the client side
dunno if it would have an impact on the stream
 
on either side
 
Knu
on the server side
well Id have to do tests but I thought that I could find a clue in the specification
it's either super detailed or not at all
 
i guess i don't understand what you're asking
if the server sends an incomplete json string...
it's going to fail to parse the json string.
Why would that be in the spec?
an invalid json string is an invalid json string
it will fail because it wasn't valid, not because it was incomplete.
 
Knu
let's say the server use the latest json spec that supports a string as the root and (for the sake of the example) .json only supports arrays and objects
 
user1596138
@BenjaminGruenbaum what is your opinion on triplebyte.com
 
user1596138
9:06 PM
lul
 
Knu
you send a string and json would fail at char 0
which is "
or would it fail at the end
e.g.
"example string"
 
@LuckyKleinschmidt Enter your email to begin! Now choose a name and a password to begin! Now tell us more about you to begin!
Fuck that.
 
Knu
@KevinB it's a hypothetical example but you get what I am saying, does the specification let's the implementators validate partial data?
 
Actually, I'm fairly sure that .json() wouldn't return for partial data
Part of the thing is that calling .json() consumes the entire request reader.
(Which is why you can't call it twice)
 
Knu
by partial data @MadaraUchiha I mean chunks of data
 
9:10 PM
@Knu .json() is expected to read (and wait) for all the chunks
 
Knu
partial as in you cut the connection if it's not valid json at that point
 
That's why it returns a Promise,
 
Knu
that's the js side
I am talking about the browser implementation
 
@Knu JSON is contextless, you can't determine whether a partial JSON will eventually be valid.
 
Knu
I gave an example earlier
12 mins ago, by Knu
but {"foo": ba
 
9:11 PM
I saw your example
 
Knu
this is invalid no need to continue downloading the rest, correct?
 
I doubt very much that Response#json() is smart enough to do that.
 
user1596138
@MadaraUchiha I said "fuckyat" way before finding a method to sign up...
 
In fact, I'm almost sure you'll find that it's just a return JSON.parse(await this.text()) underneath.
 
Knu
well that depend on the implementation but I can't find hints in the specification
 
user1596138
9:13 PM
> Multiple choice questions will get you hired at Apple
 
Knu
> you can't determine whether a partial JSON will eventually be valid.
The point is to find out if it's invalid you don't care about validity.
validity will always require to download everything…
 
You can likely implement your own version with the help of Reader.
 
Knu
yup
 
But I don't think it exists in any implementation of fetch.
 
Knu
but testing whether they did it, will take time
I dunno…
 
9:15 PM
Why do you need this anyway?
 
Knu
I am evaluating an asynchrone call on a clone, but it depends on that very information: will it wait until the data is completely downloaded?
If not json could fail too early.
> Let promise be the result of reading all bytes from stream with reader.
seems like I found my answer
It's not allowed.
How much time (hence money) could be shaved by allowing an early exit I wonder.
Clearly they assume that the server always send valid json. That's logical.
@KevinB thanks, you were right.
 
10:07 PM
Hey guys, I'm back!
And I just say this new chrome browser is BEAUTIFUL ??
Absolutely gorgeous. STUNNING.
 
you're insane
/`````\`````\`````\ for life
 
I'm not insane david
Just mostly fed up
 
@55Cancri have you considered taking up horticulture?
 
dark ?!?!?? how?!??!?
@david no, but I have considered taking up its more practical sibling: hydroponic gardening
 
10:13 PM
@55Cancri Opera :P
 
how hard is to learn ReactJS, 1 to 10?
 
user1596138
> Plebs - Opera User
 
user1596138
@Jony As opposed to? After? Before?
 
Get back to me when you have dark theme
 
React.js: 3, Redux: 9
did you change the chrome flags @Kendall Frey ??
 
10:14 PM
No
 
...
 
@55Cancri Really? redux is that hard?
 
user1596138
Nope == 0,
Redux == Nope
 
I am starting to work at some company in october, they told to learn React with Redux
 
i'm sorry
 
user1596138
10:15 PM
You'll be fine if you know JavaScript
 
well i did learn vuejs easily when I had to do some home test
 
That was my experience Jony. Of course documentation was not as extensive as it is now.
 
Ah
 
I learned React by copying an SPA, line for line
seemed pretty cool
 
heh thats what I used to do back in the days to learn PHP when my english was bad
 
10:17 PM
then I immediately tried to incorporate redux and got totally wrecked
 
Like I couldnt understand the docs at all
Isn't redux some kind of global storage
by application state
 
so after about a 2 or 3 weeks of struggling, I literally went back, ALL the way back, to just regular javascript
built a whole app in vanilla
then get pissed that I still didnt know redux and not much about react, so I went back to react
but instead of copying, I built my own app because I said screw global state, whats the point!
 
have you read/watched the stuff on flux?
 
Then I saw how quickly it became unruly to try to manage the state for every component and keep passing it down and trying to remember what went with what
and then I realized, "oh, so this is what redux is for".
 
10:20 PM
Then I spent 3 days on Udemy looking for the best and most up to date course I could find on react/redux
it was only $10, but that was a lot, and at the time, I was about one month from being homeless.
I found the course, went through all 160 or so videos and, well kind of became a god at both
at least... relative to my vanilla javascript self
I know my vanilla js self would be very impressed with my react/redux (and now typescript) magic
probably call me a witch and burn me at the stake!
or test to see if I sink or float, first
no I have not looked into flux
its a bit outdated isnt it?
I mean I know redux is based on the flux pattern... but isn't redux superior?
or is it the same thing and I'm just an idiot?
 
user1596138
🦆
 
Lucky, I have bad news.
 
user1596138
What's the news??
 
I still haven't got throttle and debounce working properly and I am dying a little bit on the inside...
Okay, let me rephrase, both throttle and debounce ARE indeed working...
just not properly.
I have a difficult question that I would like to pose to you Lucky,
but before I pose it, I would like to get your confirmation that you are ready for it
 
I feel like i can't see as much of the tab with this new chrome design.
 
10:34 PM
kevin stop hating on the new chrome design its gorgeous
 
why is your photo of a guys with his hand in your mouth
I don't get it?
@55Cancri is there some cultural trivia I am not getting?
 
user1596138
Dood
 
user1596138
It's Hayden Panettiere
 
Thanks Lucky, I was just trying to find her name on google.
its my favorite image of Hayden Panettiere.
So goddamn classy that photo
 
user1596138
lol. Classy??
 
10:42 PM
who is that
 
user1596138
An actress
 
search by image on google and find a larger size, then behold that image's classiness!
 
user1596138
She's Dot on Bug's Life
 
user1596138
@55Cancri That's how I found who it was anyway lol
 
user1596138
Looked like miley cyrus or something
 
10:44 PM
This image is a close second but lacks the energy that the first one has
 
I just don't get why that's a classy image, is the hand suppose to represent male domination, and her biting it suppose to be resisting misogynistic hegemony
 
oh my, you mustve picked the red pill Rick
 
10:59 PM
@55Cancri I like to understand. I am a man of science.
 

« first day (2881 days earlier)      last day (2083 days later) »