|
Edge still sucks I really wanted to like it but it just feels clunky and has bad aesthetics. Also lacks support for stuff...no clip-path on non-svg elements! Have had issues with flexbox too. MS should just abandon the browser game.
|
# ? Sep 7, 2018 17:29 |
|
|
# ? Jun 10, 2024 04:39 |
|
Ape Fist posted:Imagine if Google went with Dart over TypeScript in Angular. a world where Angular never took off
|
# ? Sep 7, 2018 17:58 |
|
Gildiss posted:https://reactjs.org/docs/react-component.html#componentwillunmount That's what we're doing now JavaScript code:
|
# ? Sep 7, 2018 21:18 |
|
quick thing on the lifecycle hooks in react, correct me if I'm wrong:code:
|
# ? Sep 7, 2018 22:00 |
|
Anyone else think Chrome latest is rendering text taller than it was? I think I'm seeing the bottom few pixels cut off in some embedded tweets, probably as a result.
|
# ? Sep 7, 2018 23:39 |
|
Grump posted:That's what we're doing now I could be wrong but if I remember right it is possible to manually create and cancel a promise before it is completed. Since it seems that your doRequest() function seems to return a promise (which I think is why you use `.then( () => { .. } )` ) maybe you can set its promise to a variable in the parent component and then manually cancel it from within the child component when it unmounts? Though in that case you'd have to change from an anonymous function to a named one: something like `fn_OnRequestReceived()` or whatever. I might be misremembering how Promises work off the top of my head, though.
|
# ? Sep 8, 2018 01:06 |
|
my bony fealty posted:Edge still sucks
|
# ? Sep 8, 2018 01:13 |
|
Love Stole the Day posted:I could be wrong but if I remember right it is possible to manually create and cancel a promise before it is completed. Since it seems that your doRequest() function seems to return a promise (which I think is why you use `.then( () => { .. } )` ) maybe you can set its promise to a variable in the parent component and then manually cancel it from within the child component when it unmounts? Though in that case you'd have to change from an anonymous function to a named one: something like `fn_OnRequestReceived()` or whatever. Yes, this is the way I would go about it, set a state variable to hold the Promise and and in unmount cancel the request.
|
# ? Sep 8, 2018 02:57 |
|
I just realized that react treats this = (kind) => { of function } differently than this(kind) { of function } specifically when it comes to scoping in-JSX function references. If you use the first kind of syntax, you won't need do this.function = this.function.bind(this) in the constructor(), but if you use the second you will. Anyone know why? (and what the major consequences of using function = ( argument ) => { result } over function(argument) { result } are? I always thought they were relatively interchangeable)
|
# ? Sep 8, 2018 10:23 |
Grump posted:That's what we're doing now The best solution is to move the request into Redux or whatever state-handling framework you are using. You shouldn't be fetching asynchronous data into local component state in the first place. Even if you resolve this issue, you will be doing the same request over and over as the user navigates back and forth, instead of just caching the data after the first time. If moving the request isn't possible, then I agree with everyone else that you have to either figure out a way to cancel the request, or just keep using the "anti-pattern" depending on the details of what you are doing.
|
|
# ? Sep 8, 2018 10:40 |
|
Ape Fist posted:I just realized that react treats That's just how arrow functions work. The arrow uses the "this" of the scope in which it was defined. It is a wonderful addition to JavaScript and more often than not prevents surprises. https://reactarmory.com/answers/when-to-use-arrow-functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
|
# ? Sep 8, 2018 12:01 |
|
Ape Fist posted:I just realized that react treats it's nothing to do with react, arrow functions are an es6 feature. the big benefit is avoiding all the var self=this in closures, e.g. in vanilla js code:
code:
Bruegels Fuckbooks fucked around with this message at 13:27 on Sep 8, 2018 |
# ? Sep 8, 2018 13:25 |
|
oh right.
|
# ? Sep 8, 2018 14:56 |
|
Not knowing about arrow functions and this/that/self cost me hours of frustrating debugging my first day of learning javascript. Ironically, the first solution I thought of was declaring 'that: this and using that, but I immediately thought to myself "Nah, that's some hacky thing you're doing because your a newb. Knuckle down and find out what's really wrong with your code. Do it right." A little under three months later and I'm going "Fuckit, just make it work first, then make it right later... maybe." Moto42 fucked around with this message at 01:52 on Sep 10, 2018 |
# ? Sep 10, 2018 01:48 |
|
Moto42 posted:A little under three months later and I'm going "Fuckit, just make it work first, then make it right later... maybe." With my self-learning experience, I read a thing pretty early on that I still try to stick to. It goes something like: When making stuff, you should do it in three phases, in this order:
|
# ? Sep 10, 2018 02:04 |
|
Love Stole the Day posted:With my self-learning experience, I read a thing pretty early on that I still try to stick to. It goes something like: I agree, but I also would like to point out that sometimes making it look pretty keeps you working on it longer instead of getting disappointed with it and abandoning it altogether. YMMV of course.
|
# ? Sep 10, 2018 09:17 |
|
So this is more of a general opinion question: In my professional life, I am rarely called upon to both design a back-end API and code a front end for it. Make changes to an existing API? Sure, but by and large, I am considered "full stack" only in that I can work on both, but I am rarely completely responsible for both. On my latest personal project however, I am doing everything myself, and that has raised some questions regarding overall approach. My initial pass was: back-end first. Basically: I have this data, here's some endpoints to get it out, front-end must deal with the rest. The issue is, I find I am doing entirely too much logic on my front-end - or at least what feels like too much logic. For example I have a consolidated search which returns results from multiple sources - a local one, and some remote ones. Since the remote sources aren't mine, I don't have control over what field names appear. But as I am putting together the front-end pages, I am doing an awful lot of: code:
So I guess my question is: assuming YOU are the one-stop-shop covering soup to nuts on a given app - what's your usual approach?
|
# ? Sep 10, 2018 11:48 |
|
HaB posted:So this is more of a general opinion question: in this case with the multiple datasources, you probably make it so your front end only communicates with one server, and that server communicates with all the others service to service (you can do service to service graphql queries, or you could have the service act as a reverse proxy and aggregate results). if you communicate with multiple datasources on the client, it can greatly increase the complexity of both the client code and the server code. however, the problem is going either direction (starting with client code or starting with server code) isn't going to give you that insight until you do the project and it's hosed - like, for instance, I've seen a ton of architectural quagmires in retrospect where people don't understand that message brokers like rabbitmq exist and try to make components communicate through a disgusting mess of ajax calls, and that isn't really solvable by going front-end - back-end or back-end to front end.
|
# ? Sep 10, 2018 13:17 |
|
Dominoes posted:It's nice having an epub and PDF reader built into the OS. I didn't know Edge supported epub - that's pretty neat. my bony fealty posted:Edge still sucks loling at the notion of shipping an OS without a browser in this century
|
# ? Sep 10, 2018 13:57 |
|
HaB posted:backend vs frontend When I'm developing the front and backends on my own, I start with the backend, but you should definitely be prepared to hop back and forth between the back and the front as you're fleshing out your ideas. I also make my frontend and backend completely separate projects...their own repos, their own folders on my PC, etc. This helps enforce the separateness of them in my mind.
|
# ? Sep 10, 2018 15:09 |
|
Bruegels Fuckbooks posted:in this case with the multiple datasources, you probably make it so your front end only communicates with one server, and that server communicates with all the others service to service (you can do service to service graphql queries, or you could have the service act as a reverse proxy and aggregate results). if you communicate with multiple datasources on the client, it can greatly increase the complexity of both the client code and the server code. Oh no there's only one server the client knows about. The server is responsible for aggregating the multiple sources. Thermopyle posted:When I'm developing the front and backends on my own, I start with the backend, but you should definitely be prepared to hop back and forth between the back and the front as you're fleshing out your ideas. Yeah this is what I am starting to realize. I have them as two separate repos as well. K. I was starting to figure there's no One True Approach.
|
# ? Sep 10, 2018 15:25 |
|
Munkeymon posted:loling at the notion of shipping an OS without a browser in this century I don't think MS will ever give up the browser game either, but if they did, it would surely mean shipping with Firefox or Chrome.
|
# ? Sep 10, 2018 15:28 |
|
That reminds me of the GPS fleet tracker I use on my one company vehicle for my one employee. (not a web dev or technology company) It's made by TrackmateGPS and it's something like this. They completely redesigned their website 6 months ago and its terrible. It does all sorts of requests from the frontend that should be done by the backend and aggregated into one request from the frontend. For example, the history report you can do makes this list of all the events...ignition on, ignition off, stops, gps updates, etc. It does multiple requests for each event to their own servers and to Google APIs. So, it's not uncommon for a history report to make several thousand requests from your browser which makes all other tabs unusable while they wait for a free socket to make their own requests on. Also, the scroll position on this stupid list of events resets on each request so you have to just leave the page alone until it finishes.
|
# ? Sep 10, 2018 15:32 |
|
rujasu posted:I don't think MS will ever give up the browser game either, but if they did, it would surely mean shipping with Firefox or Chrome. Yeah considering the first thing everyone does with a new Windows machine is open up Edge to download Chrome, why not just cut out that 2 minute annoyance. Ship with Chrome and Firefox preinstalled. Throw Brave in there if you wanna be wild. Bing is good tho
|
# ? Sep 10, 2018 15:36 |
|
HaB posted:Oh no there's only one server the client knows about. The server is responsible for aggregating the multiple sources. Normalizing foreign data before any of your business logic sees it is standard. It's perfectly ok for your backend process that consumes the data translate it into something that's easier for your frontend to deal with.
|
# ? Sep 10, 2018 16:32 |
|
Wanted to copy this over from the JavaScript thread to see if anyone here might know. We've just started using Styled-Components and want to test them within Enzyme. So we have a function... code:
code:
code:
code:
|
# ? Sep 10, 2018 16:42 |
|
HaB posted:So this is more of a general opinion question: you could look at something like JSON-LD if you want to normalize different request shapes into a single format. this is only really useful if you're dealing with third party apis tho. for an endpoint you control i'd just write up some json schemas and make sure both the front end and back end share them and adhere to them
|
# ? Sep 10, 2018 16:47 |
|
rujasu posted:I don't think MS will ever give up the browser game either, but if they did, it would surely mean shipping with Firefox or Chrome. Now that we're firmly in sci-fi territory, I want my own starship, too.
|
# ? Sep 10, 2018 17:12 |
|
Munkeymon posted:Anyone else think Chrome latest is rendering text taller than it was? I think I'm seeing the bottom few pixels cut off in some embedded tweets, probably as a result. A "well akshually" from SO for proof!
|
# ? Sep 10, 2018 17:35 |
|
Munkeymon posted:Now that we're firmly in sci-fi territory, I want my own starship, too. Like I said, I don't think MS will ever stop shipping their own browser, even if it ends up being something like WebKit with an MS logo.
|
# ? Sep 10, 2018 17:39 |
|
rujasu posted:Like I said, I don't think MS will ever stop shipping their own browser, even if it ends up being something like WebKit with an MS logo. They won't ship open source anything in Windows because they're afraid of getting sued, so they will never stop maintaining their own browser. I'm all for this because I think the competition is good and is why we have the aggressively mediocre Edge to replace the obstinately bad IE in the first place.
|
# ? Sep 10, 2018 18:31 |
|
Started new job today: + Cool atmosphere. + Big impressive projects with high profile clients. + Going to be in charge of developing my own little angular application for which all the end points, mock ups, specs and user stories are already done. ------------- they won't pay for a loving webstorm license and are literally forcing me to use vscode because everyone else does. (Not a dig at VSCode. VSCode is fine, I prefer webstorm.)
|
# ? Sep 10, 2018 22:09 |
|
Embrace VSCode it owns Make sure to install Prettier and have your other members do that too
|
# ? Sep 10, 2018 22:16 |
|
Will they allow you to use Live Share in VSCode? I'm seriously thinking of switching to more part time in that IDE just for that.
|
# ? Sep 10, 2018 22:35 |
|
huhu posted:Wanted to copy this over from the JavaScript thread to see if anyone here might know. Ask yourself: why am I testing the CourseRating component in my ResultListItem component test? If you have a test for CourseRating, this test is pointless.
|
# ? Sep 11, 2018 02:16 |
|
Lumpy posted:Ask yourself: why am I testing the CourseRating component in my ResultListItem component test? Solid question. I'll definitely need to think on that.
|
# ? Sep 11, 2018 03:09 |
|
New question - I've got an API where I'd like to save formatted text (thinking HTML) and then send that to a React front end to be displayed as a blog. However React doesn't seem to like this, with the suggested solution being code:
|
# ? Sep 22, 2018 15:27 |
|
huhu posted:New question - I've got an API where I'd like to save formatted text (thinking HTML) and then send that to a React front end to be displayed as a blog. However React doesn't seem to like this, with the suggested solution being Markdown?
|
# ? Sep 22, 2018 16:16 |
|
Theres a package called ReactHtmlParser that'll do it without dangerouslySetInnerHtml Idk what it uses under the hood though
|
# ? Sep 22, 2018 16:21 |
|
|
# ? Jun 10, 2024 04:39 |
|
They are really just trying to make you think about XSS attacks with the naming. Any other way of doing it is going to have the same code at the bottom, it just might hide it from you.
|
# ? Sep 22, 2018 16:22 |