Questions tagged [observable]

An observable is typically a programming construct that can be "watched" by other parts of the code, called the "observers". Different frameworks and programming languages have different implementations for observables, so this tag should typically be used in conjunction with others.

Filter by
Sorted by
Tagged with
1 vote
3 answers
66 views

How to make synchronized method in Angular service?

I have an Angular 15 application that have a few components which invoking the service method to retrieve some data from the backend. Before the execution the service is checking is there is a ...
Alexander Kozlov's user avatar
0 votes
1 answer
35 views

Angular Guard Function Return Boolean Observable

I need to have a route guard function read in some data from the localStorage, but because of how angular executes (from what I have read) it doesn't wait to read in the values before completing the ...
ZombieCode's user avatar
  • 1,658
0 votes
1 answer
29 views

How to keep track of changes of objects in my array

I try to develop my first app, which is a quiz app. Here is my class for the Quiz player: class QuizPlayer: ObservableObject { @Published var name: String @Published var points: Int @...
kanstinho's user avatar
0 votes
1 answer
48 views

SwiftUI Listeners/Observation Trouble

I'm having an issue where my listener doesn't update my UI correctly when I define my data structure as a class, but works properly when it is a struct. func addUserListener(owner: Bool) { guard ...
lionsfan's user avatar
-2 votes
0 answers
19 views

Observable can't observe Move action on ObservableCollection

Observes Move operation on ObservableCollection as Replace, but not Move. ChangeSetObservableTest .Filter(....) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out ...
Lil pointer's user avatar
0 votes
0 answers
9 views

Process events in batches with event subscription model c#

I have a dashboard which saves one or more events and a service which will get triggered upon receiving each event. Dashboard can be used by multiple users and save multiple events at the same time. ...
Chaitanya Chintala's user avatar
0 votes
0 answers
32 views

Android: NPE: Observable.takeLast

I set up some observables like so companion object { var isLocationToolActive: BehaviorSubject<Boolean> = BehaviorSubject.createDefault(false) var isAoIToolActive: ...
kristyna's user avatar
  • 1,370
1 vote
2 answers
63 views

Change detection with RxJs Angular Signals, how to read new data in observable?

I am attempting to utilise Angular's new Signal feature but struggling with reactivity. Current Method From understanding so far, to work with RxJS and Signals correctly the output of this observable ...
gt57096's user avatar
  • 11
0 votes
0 answers
16 views

Spring-Data-JPA Observable "findAll"-Results

The CrudRepository.findAll(Specification<EntityType>) method returns a "snapshot" kind of result List of entities that represents the resultset of the given query by the time the ...
Tom's user avatar
  • 93
0 votes
0 answers
50 views

The component didn't catch the updated error message from the service

export class Component implements OnInit { error$: Observable<string>; constructor( private errorService: ErrorHandlerService ) { this.errorService.errorPublic.subscribe((...
DaroGawlik's user avatar
1 vote
1 answer
36 views

Methode return status cancled when using take(1) and when not using it it is lunched multiplit time

handleRedirect is a method that calls two observable. the first is ValidateCartService.getValidateCart() with Observable type and the second ValidateCartService.setCart() . once the two methods are ...
mohamed karim rebey's user avatar
0 votes
0 answers
26 views

Android : How to observe three different sql queries and get multiple different results using RXJava

I want to observe three different sql queries which return three different kind of result. For this I have tried the below code. var searchTicketsObservable = ticketHoldersRepository.getSearhTickets(...
sridhar venkatesan's user avatar
0 votes
1 answer
51 views

How to subscribe while creating an observable?

I have an observable emitting an ID. I want to retrieve an element with that Id and store it into a new observable. However, this observable needs to be subscribed to in order to emit its value. ...
TheBlackBird's user avatar
0 votes
1 answer
66 views

Why doesn't my view update ObservedObject inside a different View in SwiftUI?

My ObservedObject will not connect with another view. I have: class AppState: ObservableObject { @Published var destination: String = "" @Published var arrivalTime = Date() @...
PW1990's user avatar
  • 413
0 votes
0 answers
14 views

Interactive Shiny or Observable JS Slide in Quarto Presentation?

I am making a quarto presentation illustrating different features and the benefits to making presentations in quarto for colleagues. I can't seem to find a simple example demonstrating an interactive ...
Eizy's user avatar
  • 275
-1 votes
2 answers
42 views

strike on subscribe while coding in angular. Its says depreciated on hover [duplicate]

I am still figuring out angular. I am working a form to post user details. The form is working and i can see the values in database. Problem is i see a strike on subscribe and on hover it shows the ...
Ashin Kurian's user avatar
0 votes
1 answer
42 views

Dynamically Accessing SwiftData Parameter

I'm facing a challenge in Swift and seeking advice. I have a class Results that contains various parameters, and it's a SwiftData Model. Therefore I want to change it directly, as it is observed then. ...
Serafin's user avatar
0 votes
0 answers
39 views

Is it possible to use @Observable objects with Combine [duplicate]

Given this Example-Class: class SomeClass: ObservableObject { init() { $someState .map { !$0 } .assign(to: &$someOtherState) } @Published public var ...
Zaggo's user avatar
  • 786
0 votes
1 answer
29 views

Catch Http Response Errors in Rxjs Epic using Fetch

In React, I need to examine the HTTP error response objects (e.g. a 400 bad request has a sub-object with each failed validation message) but the normal means of using catchError doesn't allow this, ...
Rob's user avatar
  • 1
0 votes
0 answers
47 views

while calling api recursively the last call cancelled without throwing error

addItems() { this.addservice .addToCart(this.currentBatch, this.batch) .pipe( concatMap((res) => { if (res) { const success = res.filter( (item) => !!(item....
Mohammed Rabiulla RABI's user avatar
0 votes
1 answer
22 views

Mock derivative Observable stream

I can not properly mock the derivative Observable stream in Jest/Angular app. Basically I need to test NgRx effect. export const cancel$ = createEffect( ( actions$ = inject(Actions), ...
Yurii_I's user avatar
  • 23
0 votes
1 answer
34 views

Processing batched events with RX Observables in Hosted Service

I have the following scenario: public class MyHostedService : BackgroundService { private readonly IServiceProvider _serviceProvider; private readonly IEventSource _eventSource; private ...
mnj's user avatar
  • 2,795
0 votes
0 answers
38 views

@angular/fire modular equivalent to "compat" code to listen to snapshotChanges

How would I rewrite this function in the latest "modular" version of angular firestore? getLatestEntries(limit = 5) { return this.db.collectionGroup('Entries', ref => ref.orderBy('...
user1498688's user avatar
0 votes
0 answers
24 views

Subscribing to browser url bar changes performed with location.go/location.replaceState

I'm looking to track URL changes made via location.go(..) or location.replaceState(..) and ideally want to use an Observable for this. Since these methods bypass Angular's router, I can't use router ...
Carlo Arnaboldi's user avatar
0 votes
0 answers
11 views

QuantLib's SwaptionVolCube1x<Model>::marketVolCube() is very slow

SwaptionVolCube1x::marketVolCube() is very slow when the SwapIndex passed in is an OIS Index. When SwapIndex is a non-OIS for example, EURIBOR_6M. the calculation is pretty fast. The source code of ...
Peaceful's user avatar
  • 482
0 votes
1 answer
16 views

RxJava subscribeOn conditionally

I would like to apply subscribeOn based on the condition on Observables. For example in the below code Observable.just("One", "Two", "Three") .flatMap(v -> ...
Raghavendra Prasad's user avatar
0 votes
0 answers
41 views

How to create a Stream out of IObservable<byte>?

I've been thinking how to create a bridge between IObservable<byte> and Stream, but I'm completely lost. The use case for this is when a function needs you to provide a Stream, but you have your ...
SuperJMN's user avatar
  • 13.4k
0 votes
2 answers
59 views

SwiftUI TabView selection in @Observable resets content on tab change

I'm creating an app in SwiftUI, where I want to have @Observed class keeping selected tab and maybe navigation path in the future. Architecture I'm working on is MVVM. Currently when I switch tab and ...
ninja_iOS's user avatar
  • 1,183
1 vote
1 answer
34 views

Callback on calling unsubscribe from subscription RxJava

I am trying to learn RxJava and going through some content. I came through this example where Subscriber unsubscribes soon after subscribing to observable. public static void main(String[] args) { ...
Manish's user avatar
  • 1,348
6 votes
1 answer
90 views

RxJS polling + retry using a backoff strategy

I've been trying to implement my own RxJS operator, so that I can "plug it" to my Angular's HttpClient. I'd like to keep the request ongoing (polling) every X milliseconds, but also in case ...
kari's user avatar
  • 191
0 votes
0 answers
26 views

windowed-observable is not working in react

I am working on react micro frontend app, I have a host with products and order modules, and I am sending data from products but in orders, I am not able to receive data using windowed-observable. ...
skyshine's user avatar
  • 2,786
0 votes
2 answers
71 views

Converting Stream to Observable

I've tried with this, but it seems to have concurrency issues. I don't fully understand what is wrong. public static IObservable<byte> ToObservable(this Stream stream, int bufferSize = 4096) { ...
SuperJMN's user avatar
  • 13.4k
1 vote
1 answer
30 views

Subscribe to multiple Observables in a loop in Angular

I have the following issue: I have to loop through an array of objects (orders). For each order i do some processing, which is not relevant for now. Then i have to make multiple API calls for each ...
Alex's user avatar
  • 111
1 vote
3 answers
57 views

Async pipe not working with piped observable

I have the following Angular component and HTML and I am wondering why nothing gets displayed. The class gets added (first line of HTML), but I don't see any results even though the service returns ...
Applecow's user avatar
  • 808
0 votes
0 answers
36 views

How to unit test timer() observable with jasmine marbels

I'm trying in angular application to unit test ngrx effect that introduces some polling logic using timer and maps to some actions depending on the value from some selector. My code is something like ...
AndrewN's user avatar
0 votes
1 answer
35 views

How to break FileList for loop Angular 16 in HttpClient Observable

I need break FileList FOR loop in error case in HttpClient Observable. I make a request with post method for upload 1 file for each loop iteration. This is my code, but not working, not breaking loop. ...
Juan David Luna's user avatar
1 vote
1 answer
30 views

Multiple nested subscribe with conditionals and keeping all the data from all the subscribes?

I require multiple calls to the services with subscribe, but each service api call is dependent on the previous call's data. I need to keep a record of all the data for each subscribe. I also have ...
Gintoki's user avatar
  • 51
0 votes
0 answers
20 views

Incrementally transfer objects

I wanted to sync an object with another object on a different computer. The Problem: The Object is very big. It's a list with approximately 100 000 000 Entries. I want to sync the object basically ...
HerzogVolpe's user avatar
0 votes
1 answer
178 views

Observation and SwiftData Different Property Dependencies

Expected behaviour: The view is only updated when I edit the property text1 showed on screen I'm getting the expected behavior whith Observation but not with SwiftData. Why? I thought SwiftData models ...
quaternionboy's user avatar
0 votes
1 answer
73 views

.NET MAUI query parameter and community toolkit issue

I tried to pass an object parameter thru ViewModel Books to ViewModel Book Detail. I defined both viewmodels as ObservableObject and used a dictionary in ViewModel Books to pass parateter like below: ...
Mertez's user avatar
  • 1,071
1 vote
0 answers
35 views

Angular smart pipe

The smart vs dump component design is well established. I am trying to apply it where it's feasible. I use facade services to store/update my data, something like this (vastly simplified): models: ...
Hafnernuss's user avatar
  • 2,723
3 votes
0 answers
38 views

Why do Observable Objects notify observers before the change occurs rather than after in Swift? [duplicate]

The new Observation features come with a withObservationTracking(_ apply:onChange:) that executes the onChange closure when any property accessed in the apply closure is modified. However, the ...
rayaantaneja's user avatar
  • 1,444
2 votes
1 answer
176 views

@Observable is being re-init every time view is modified in SwiftUI

I am surprised and don't really understand the behavior I am seeing with the new @Observable framework in iOS 17. It seems that if the view containing the @State var, ie viewModel, is modified, then ...
Astro's user avatar
  • 137
1 vote
1 answer
144 views

Combine and Observable Macro iOS 17

I have read the migration guide and am still stuck on this one. In the spirit of the migration guide ... OLD class MyClass: ObservableObject { @Published var myVariable: String = "Need to ...
Jon Vogel's user avatar
  • 5,354
0 votes
1 answer
18 views

Unit tests for Angular observable to modify observable return value for different test cases

HTML <ng-container *ngIf="configuration$ | async as configuration"> .... </ng-container> TS configuration$ : Observable<Configuration> = this.configService.configuration$;...
shubham_agrawal's user avatar
0 votes
1 answer
29 views

Property 'subscribe' does not exist on type 'Todo[] | Observable<Todo[]>'

im trying to create a crud todo application with angular and started to create a service for calling the backend task.service.ts getTasks() { // check if app is online if (this....
Philipp's user avatar
  • 15
0 votes
1 answer
33 views

Observable displays data before being populated

I'm making a simple API call to get users data, here's the service: the service contains setUsers() method that allows to populate userSubject @Injectable({ providedIn: 'root' }) export class ...
R-Safe's user avatar
  • 11
2 votes
0 answers
33 views

How to use @Observable Macro in Unit Tests in Swift?

How can I make assertMacroExpansion(_:expandedSource:macros) expand the @Observable macro? I tried passing in Observable.self in the macros parameter but that didn't work. I also tried importing ...
rayaantaneja's user avatar
  • 1,444
2 votes
1 answer
157 views

Can't use Property Wrappers on a class marked with @Observable

I have a class which is similar to: final class Person { @Resettable var name = "John Doe" func revertName() { name = $name } } @propertyWrapper struct Resettable&...
rayaantaneja's user avatar
  • 1,444
0 votes
0 answers
45 views

RXJS: Easiest way of implememnt react-query-like caching with observables (stale-while-revalidating)

The default way of implement caching with observables is this one: import { shareReplay } from "rxjs"; import { fromFetch } from "rxjs/fetch"; const source$ = fromFetch("...
Vitor Figueredo Marques's user avatar

1
2 3 4 5
192