New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

anyway, ive boiled down my typescript problem to this

TypeScript code:
var myId = this.http.get<any>(this.apiUrl).pipe(data => data.id);
which complains that "Property 'id' does not exist on type 'Observable<any>'"

ive tried using a type instead of any (eg just a dumb interface HasID { id: number }) but it still complains that Observable<HasID> doesn't have an id

so i assume it has to do with the wrapping Observable :shrug:

Adbot
ADBOT LOVES YOU

zokie
Feb 13, 2006

Out of many, Sweden
I don’t know what http client you are using or what pipe does, but Observables are usually something you subscribe to and get called when things happen so if it says that Observable<{ id: string }> doesn’t have id that is because you are trying to access it on the observable and not its ”payload”.

Like if you tried to access .id on a Promise and not inside the then(thisWouldHaveId =>)

Mind_Taker
May 7, 2007



You probably need to use the map operator:

TypeScript code:
var myId = this.http.get<any>(this.apiUrl).pipe(map(data => data.id));
And then yeah you need to subscribe to myId to unwrap it.

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

that at least compiled!

but it just propagates the observable so when its checked later it does not match a numeric id :P


e: the http client is this:
https://v17.angular.io/api/common/http/HttpClient

Carthag Tuek fucked around with this message at 14:55 on Feb 13, 2025

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

ugh i dont care about any of this poo poo, i just wnt to add a loving id to a goddamn object

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Carthag Tuek posted:

that at least compiled!

but it just propagates the observable so when its checked later it does not match a numeric id :P


e: the http client is this:
https://v17.angular.io/api/common/http/HttpClient

compare the ids as numbers:

Number(theIdYouWant) === Number(theIdYouGetFromTheAPI)

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

Wheany posted:

compare the ids as numbers:

Number(theIdYouWant) === Number(theIdYouGetFromTheAPI)

:cry:

current code. i only want to add the dbId, which wasnt there before (previously it returned the of() directly without the wrapping http get):

TypeScript code:
    private GetUserAndGetMetadata() : Observable<User> {
        return this.auth.user$
        .pipe(
            concatMap((user) => {
                if(user == null || !user.sub){
                    throw new Error("User not logged in, user service");
                }

                return this.http.get<any>(this.apiUrl).pipe(map(data => {
                    // if i set a breakpoint here, i can see that data contains the user id and it is numeric
                    return of({
                        auth0Id: user.sub,
                        dbId: data.id,
                    });
              }));
            }),
            catchError((error) => {
                console.log(error);
                return of(error);
            })
        )
    }
elsewhere, the dbId checked. i havent touched this code at all except to try out Number():

TypeScript code:
    public IsSuperUser() : Observable<boolean> {
        return this.IsUserLoggedIn().pipe(
            concatMap((loggedIn) => { 
                return this.GetUserAndGetMetadata().pipe(
                    concatMap((user) => { 
                        return of(this.GetSuperUsers().indexOf(Number(user.dbId)) != -1); // breakpoint here, and user is an Observable and user.dbId is undefined
                    }),
                    catchError((error) => {
                        console.log(error);
                        return of(false);
                    })
                );
            })
        );
    }
i guess the mistake is that im now returning an observable within an observable and only the outer gets unwraped durin gthe later check?

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

ah, just remove of() lol

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
what a great function name, of(). super descriptive

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

DELETE CASCADE posted:

what a great function name, of(). super descriptive

yeah. also fantastic documentation:
https://www.learnrxjs.io/learn-rxjs/operators/creation/of

:nallears:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

DELETE CASCADE posted:

what a great function name, of(). super descriptive

i assume that's like Observable.of(thingThatIsSupposedToBeWrapped)

bob dobbs is dead
Oct 8, 2017

Peeps are idiots, Leslie.
Nap Ghost
that poo poo needs to be burnt in fire. along w the rest of both angular and angularjs i guess

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
imagine my joy when I was looking at the rxjs docs for the first time a few days ago wondering how carthag's thing was supposed to work, feeling kinda grossed out, then today getting moved to a different team at work and seeing rxjs in their package.json

Subjunctive
Sep 12, 2006

ask me about nix or tailscale

pokeyman posted:

imagine my joy when I was looking at the rxjs docs for the first time a few days ago wondering how carthag's thing was supposed to work, feeling kinda grossed out, then today getting moved to a different team at work and seeing rxjs in their package.json

getting hosed the day before Valentine's, nice

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

pokeyman posted:

imagine my joy when I was looking at the rxjs docs for the first time a few days ago wondering how carthag's thing was supposed to work, feeling kinda grossed out, then today getting moved to a different team at work and seeing rxjs in their package.json

lmao sorry for passing on the curse

well-read undead
Dec 13, 2022

DELETE CASCADE posted:

what a great function name, of(). super descriptive

of(x) returns the onlyfans url for x

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

that's just a list of examples and "recipes" you can copy paste without understanding them. the real documentation is linked at the bottom

mind you the "in-depth dev reference" is a 404 and the official documentation link has a bit of a terse description section and a diagram of questionable utility, but hey, the links are there

akadajet
Sep 14, 2003


I’m not a fan of excessive rxjs use, but that’s like the simplest and most easy to understand method they have

akadajet
Sep 14, 2003

even angular has acknowledged that observables are a pain in the rear end and is moving to simpler signals

Quackles
Aug 11, 2018

Pixels of Light.



how do we feel about XAML bindings?

I know how I feel about XAML bindings.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
rx feels a lot less useful when you are single threaded and your standard library has promises

but we used rx on the other platform so obviously it’s a good fit on this one and yes a bunch of operators have different names and/or subtle but relevant changed in implementation no I will not be taking questions thank you

barkbell
Apr 14, 2006

woof
once you let observables in they infect everything

gbut
Mar 28, 2008

😤I put the UN🇺🇳 in 🎊FUN🎉


tell me about it. I’m still calling all my former partners.

Bloody
Mar 3, 2013

Quackles posted:

how do we feel about XAML bindings?

I know how I feel about XAML bindings.

they’re fine

Bloody
Mar 3, 2013

rx seems bad to me tho

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.



After another argument of "confluence is hard to read developers just need jiras" and me expressing my medication change induced extreme displeasure about the lack of willing for anyone to bother understanding anything and wanting to be spoon fed "as a user I..." poo poo when this stuff is complicated and that "you need to understand the whole and more importantly *I* need to be comfortable that you understand it", things got into "well if you're saying we need a framework to do this then are you saying that's what we need to do because we looked and there isn't one so we'd need to investigate it" and I had to go off with what I've wanted to say for months: not only can this be done but I've done it. I already sent you a relational model that was built in 2007 that can do this and still works today and I wrote a new UI layer on top of it while learning .net mvc in 2016, it's now 2025. Go read the model. Go read the docs. Go look at the current system and use your loving brains

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
confluence isn't hard to read. sure, it's hard to do everything else in confluence: edit documents, search for documents, attach documents... it's like a knowledge black hole. but should you somehow find what you are looking for, you can read it just fine. you can see from the last edit time that the page is 3 years old, and the author no longer works at the company. have fun!

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.
I never found Confluence hard to edit or add to, but that could be because I had pretty expansive permissions

at least I never had to touch Jira since we had Radar and Radar was awesome (even if most of the UI changes in the Radar 8 client were poo poo)

FlapYoJacks
Feb 12, 2009
we replaced Jira/confluence with knowledge base and it’s extremely good.

abraham linksys
Sep 6, 2010

:darksouls:
confluence has the best wysiwyg editor i've ever used and the search seems fine

akadajet
Sep 14, 2003

abraham linksys posted:

the search seems fine

it’s not. you’ve either never used it or are lying

root of all eval
Dec 28, 2002

At my place there is a push for committed markdown docs. So Cursor can scan them.

Sapozhnik
Jan 2, 2005

Nap Ghost
i like the idea of a monorepo which also contains docs that are updated as part of the same commit/pr that updates the code. dunno how well it works in practice but it does seem nice (also business types would never lower themselves to touching any of that weird "bit hub" stuff with the nerd symbols in it, upload an industry standard Microsoft Word document to SharePoint, please).

confluence is fine, i don't have any complaints. it isn't abysmally slow like jira so it has that going for it. i maintain a modest base of information in confluence and sometimes people even read it!

well-read undead
Dec 13, 2022

the problem with confluence isn't technical, it's the exact problem that literally all documentation has: if nobody maintains it, it will become very bad, no matter how good it started

as a tool it's fine

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
this is true for, well, everything affected by entropy, which it is my understanding is the vast majority of things

as far as confluence goes, i'll never forgive them for removing support for markup and forcing people to use some editor gui thing instead. beyond that i hate it but that's my default stance for software

oh and for the search i think a while ago they changed stuff to be "ai powered" so you're gonna get garbage by default

well-read undead
Dec 13, 2022

Deep Dish Fuckfest posted:

oh and for the search i think a while ago they changed stuff to be "ai powered" so you're gonna get garbage by default

i've seen them sneak in ai poo poo in other places but afaik our search is not "ai powered" in any meaningful sense. still works the same as it used to, not stellar, but not bad by any stretch

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

well-read undead posted:

the problem with confluence isn't technical, it's the exact problem that literally all documentation has: if nobody maintains it, it will become very bad, no matter how good it started

as a tool it's fine

it's a slow, resource-heavy webpage that provides an unpleasant text editor

so yeah, it's about as good as anything else

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
as a user I would like the developers to be happy and productive by using confluence by atlassian

root of all eval
Dec 28, 2002

You can only activate one toggle at a time unfortunately

Adbot
ADBOT LOVES YOU

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

pokeyman posted:

as a user I would like the developers to be happy and productive by using confluence by atlassian

so you're going to what, give them an opioid drip?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply