Questions tagged [dispatch]

Dynamic dispatch (also known as dynamic binding) is the process of mapping a message to a specific sequence of code (method) at runtime. This is done to support the cases where the appropriate method cannot be determined at compile-time (i.e. statically).

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

after returning a state not able to override the value of a cart with a new value in in react.js

I am completely new in react js and this is my first project. I have used Reducer to push item in cart but I am getting data in console but not able to in cart. StateReducer.js export const ...
0 votes
0 answers
57 views

SwiftUI - Loading image with DispatchQueue

I understand how to utilize DispatchQueue with UIKit, but not with SwiftUI, because HorizonCalendar requires SwiftUI to function. Everything works perfectly, however as I browse down and load an image,...
0 votes
1 answer
34 views

how to use useSelector() in multiple dispatch()

I am trying to display the length of the student and teacher from the store's state. but why is it that when using multiple dispatch(), it is overlapping to the previous dispatch() hence, displaying a ...
0 votes
1 answer
9 views

Chained dispatch based on result from onAuthStateChange runs forever without apparent reason

Im trying to update my redux state value based on onAuthStateChanged. When the user value changes i want my redux store to reflect that. The onAuthStateChanged triggers a dispatch that sets the ...
0 votes
2 answers
39 views

How do we dispatch to different class methods based on the number of input arguments?

We want to have a class with two methods of the same name, however: there exists a method which accepts exactly one argument. The other method accepts two or more arguments. Maybe, to implement ...
2 votes
0 answers
43 views

Lazy loading images with Intersection Observer Api in React by dynamic redux state

I've been trying to create dynamic image elemens which is going to lazy load when images shown on screen. Besides , image src and alt attribute that come from redux state , this state changes with ...
0 votes
1 answer
28 views

React-redux dispatch triggers action creator but reducer is not called

I am trying using modules redux, react-redux to switch the current view shown in an app, but dispatching my action creator does not call the reducer. I have used console messages to show that the ...
0 votes
0 answers
18 views

Infinite Loop in useEffect with dispatch and axios

I am trying to check in my App.tsx if the token is valid and saving user info in redux but I get an infinite loop.. any idea? function App(): JSX.Element { const [isLoggedIn, setIsLoggedIn] = ...
  • 3
0 votes
0 answers
21 views

How to extend a function without changing the function itself

I'm curious if I could augment/extend the functionality of a base function using functools techniques. I'm putting together a module with many methods returning generators, and I'm looking for an ...
  • 170
0 votes
0 answers
33 views

What is the point of using dispatch as a dependency in useEffect [duplicate]

I see some code in a project I am working on: const dispatch = useDispatch(); useEffect(() => { // some code }, [dispatch]); What is the point of using [dispatch]? Why not just use []?
2 votes
1 answer
36 views

How can I apply globally to Pinia state actions?

How can I apply globally to Pinia state actions. I know how to send data (user) as an attribute to Vuex. But how can I do something similar with Pinia. As well as is there a way do accomplish similar ...
0 votes
1 answer
20 views

custom package can't read useState when installed on another package

I have created a custom component into a private repostory / registry and it's working locally (tested with storybooks). When I do "npm install" it gets correctly installed into the other ...
0 votes
2 answers
45 views

dispatch in Redux won't add new data in store

I have an array of incomes that I display in a table. There's a "+" button to add a new income. I want to increment database and redux store with a dispatch. Increment database works fine, ...
  • 1,710
0 votes
0 answers
39 views

Dispatch is not saving data in data layer in React Context API

I'm following a tutorial where they are making a clone of Spotify. And to avoid prop-drilling I'm using React Context-API to save and pull user data for that I first tried to get the user and token ...
2 votes
3 answers
86 views

Job-based cloud processing solution

I would like to do some cloud processing on a very small cluster of machines (<5). This processing should be based on 'jobs', where jobs are parameterized scripts that run in a certain docker ...
  • 83
0 votes
1 answer
46 views

How can I add an event handler to my dropdown so that <onChange> of the dropdown value, all the value representations on the screen changes?

UI: I have a dropdown list with four types of currencies. Every time I pick a new currency, the currency representations on the screen should also change. When I choose the first time, let's say Euro,...
0 votes
2 answers
379 views

Laravel dispatch same job with chain with different id and delay

i am new to php/laravel, trying to understand the dispatch method. I use dispatch in a long loop of several thousand of data, in the end of the loop he is run : RunDispatch::dispatch($id)->delay($...
  • 1
-1 votes
1 answer
42 views

Why is my product Item not increasing or decreasing in my Reactjs

I am creating an ecommerce product website, I am trying to add product increase and decrease dispatch function to increase or decrease product in the basket. I am using useContext api with reducer ...
0 votes
1 answer
55 views

SwiftUI: dynamic view dispatch? Polymorphic views?

I'm a Swift/SwiftUI beginner and am trying to make a program that visualizes a few different types of data (w/ swift 5.7, targeting macOS). I have a root "Data" protocol, and a few different ...
  • 6,478
0 votes
0 answers
25 views

What's the dispatch method of this function?

What's the dispatch method of the function in the snippet? extension KeyedDecodingContainer where Key == JsonCodingKey { @inline(__always) func decode<T: Decodable>(key: String) throws -&...
0 votes
1 answer
29 views

How to define functions for specific variants

I have an enum with an associated show function. enum Foo { Bar(u32), Baz } fn show(foo: Foo) { match foo { Foo::Bar(_) => show_bar(foo), Foo::Baz => show_baz(foo), ...
0 votes
1 answer
133 views

On dispatch it is showing me Uncaught RangeError: Maximum call stack size exceeded

I'm dispatching an logout action from Navbar component but it showing me maximum call stack size exceeded whenever i click on logout button. authSlice.js: export const logout = createAsyncThunk("...
0 votes
1 answer
34 views

use the variable returned by cakephp controller

I am using cakephp 2.10.24. I need to use the variable returned from the controller in a php file(not a view), so I used the dispatch function to make a Cakephp request. The data is displayed by ...
0 votes
1 answer
48 views

I don't understand the order that code executes when calling onAppear

I have been getting this problem now a few times when I'm coding and I think I just don't understand the way SwiftUI execute the order of the code. I have a method in my context model that gets data ...
0 votes
0 answers
25 views

Change dispatch for *all* generics

Problem Given an object A wrapped in an object E (say an environment or list), is there a universal way to instruct R to dispatch on A whenever a generic is called on E? Use case Usually contents can ...
  • 185
0 votes
0 answers
27 views

Uncaught TypeError: dispatch is not a function while clicking on submit

After entering the text in input field and clicking submit button the error occurs: Unhandled Rejection (TypeError): dispatch is not a function boundActionCreators.<computed> [as setAlert] ...
0 votes
0 answers
144 views

Python Multiple Dispatch on only some arguments

What I would really like to do is make a function with a default first argument def do_thing(self, category:str='default', sub_category:str, argA:int|float, argB:int|float, argC:int|float) ... obj....
0 votes
1 answer
39 views

Retrieved data from firebase v9 is undefined

When retrieving data and console.log it, the data shows perfectly, but when trying to dispatch the action with the argument as a data it turns out to be undefined. I tried to use await before dispatch ...
  • 15
0 votes
1 answer
101 views

How to dispatch methods of a superclass?

I would like to decorate the shapely.geometry.Point class to instantiate it from a dendropy.datamodel.basemodel.AnnotationSet object. I chose the multimethod package to dispatch __init__ of the ...
  • 672
0 votes
1 answer
263 views

Redux toolkit error dispatching object Error: Minified Redux error #7

Does anyone know why am I getting this error? I think it's related to thunk middleware, I'm using configureStore in my redux toolkit, I'm just trying to dispatch an array of objects data from Axios ...
0 votes
0 answers
29 views

Trying to update pieace of state and send back to firebase get a Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf')

Currently I'm working on feedback app. Trying to edit feedback and send the updated one to the firebase. Unfortunatelly nothing got updated and it throws an error Can't find a place where is the ...
  • 15
0 votes
1 answer
17 views

How can I fix type Error as I am just trying to add an item

I am working with redux and I have my actionCreator to add to cart also my reducer function which are below but I keep getting error message which says "actionCreators.js:44 Uncaught TypeError: ...
0 votes
1 answer
14 views

UseDispatch hook react-redux

Help me to understand. i use useDispatch but i don't change the state. what am I doing wrong. I read a lot of information, but I can not understand what is my mistake. i tried other hooks but ...
0 votes
0 answers
16 views

may i use this code for finduserDetail in react using redux-thunk dispatch to calling function

This code for finduserdetail by hitting function with help of dispatch method and passing (match.params.id) not working, even function not called as I know on dispatch method it should be called how ...
-1 votes
1 answer
383 views

import useDispatch causes an error "useReduxContext.js:24 Uncaught Error: could not find react-redux context value;.."

Trying to useDispatch in SidebarOption.js component in order to select/switch between chat rooms. After that I'm getting an error useReduxContext.js:24 Uncaught Error: could not find react-redux ...
  • 15
2 votes
1 answer
47 views

How to pass through call of dispatched method and combine with defaults?

I have a generic function foo, a respective default method, and e.g. a formula method. If the default method is dispatched the call to foo.default should be returned as an attribute, whereas if foo....
  • 56.5k
0 votes
1 answer
161 views

Dispatch and get elements to render reactjs

I have an array with 2 elements to render ItemComponent In ListComponent i dispatch to call api and get 2 difference image to set varible image in store const ListComponent = (array) => { const ...
0 votes
1 answer
12 views

How to retrieve data after successful redux dispatch inside a SignIn form component

I have a SignIn form. When the login and pass submitted I am using dispatch to send data and get the JWT token. Form code: import React from 'react'; import Avatar from '@mui/material/Avatar'; import ...
0 votes
1 answer
148 views

Multiple components decide to fetch an object at the same time

I have a React component that somehow looks like this: function MyComponent(props) { const dispatch = useDispatch(); // Redux dispatch function const isLoading = useSelector(selIsLoading); // ...
  • 1,763
0 votes
0 answers
56 views

react redux is not calling dispatch

when I submit the booking form the dispatch action is not calling, I thought is from the redux version but it does work for login and register form. my code looks like booking.jsx import React, { ...
-1 votes
1 answer
119 views

Problem accessing indexed results two stage stochastic programming Pyomo

When running a stochastic programming problem in Pyomo, the resulting solution works only when running 10 precisely the same scenarios but the results remain zero when running different scenarios. I ...
0 votes
0 answers
71 views

Pyomo: most efficient limited foresight operational optimization of PV battery system?

I want to optimize the operation of a grid-coupled PV battery system with Pyomo. I assume a given timeseries of PV power and electricty load in kWh and a static grid selling and buying price. But I do ...
  • 11
0 votes
1 answer
114 views

How to properly index scenarios in a two stage stochastic programming in Pyomo?

Main question: How to define the wind scenario parameter so that it can provide different wind scenarios for different probabilities in scenario set 'S'. When running the stochastic code with scenario ...
1 vote
2 answers
112 views

Trigger function to roll a dice

I have a function to get a random value (1->6) to roll a dice: const rollDice = () => { document.dispatchEvent( new CustomEvent('rollDice', { detail: { value: Math.floor(Math.random()...
0 votes
2 answers
128 views

Progress bar in tableview cell?

How do I use a progress bar when my script is doing some task that is likely to take time? For example, a function which takes some time to complete and returns True when done. How can I display a ...
0 votes
0 answers
85 views

animated plot in python

hope you are doing fine i want to plotting an animated plot to watch a point go to its specific destination(the point could be a moving car though) point location has specified with a numpy array that ...
2 votes
1 answer
106 views

Can I pass a Arc<dyn MyTrait> to a function that expects Arc<impl MyTrait>?

In Rust for Rustaceans, Jon Gjengset states (emphasis mine): When you’re given the choice between static and dynamic dispatch, there is rarely a clear-cut right answer. Broadly speaking, though, you’...
0 votes
0 answers
169 views

React Redux How to ensure Item is deleted without needing to refresh page using dispatch and slice

I am working on the following tutorial: https://www.youtube.com/watch?v=UXjMo25Nnvc&list=PLillGF-RfqbbQeVSccR9PGKHzPJSWqcsm&index=4 Full GitHub project here from Brad Traversy: https://github....
0 votes
1 answer
125 views

I have a problem with dispatch event in redux

On the first click the data array received from dispatch is empty, however if i click on the save button one more time it works perfectly fine. Here what i get from the console from Account.js As you ...
0 votes
1 answer
169 views

How to set Cloud Tasks dispatch when load balancer and GAE are combined

I'm using Cloud Tasks from GAE now. Also, by setting GAE as the backend of the load balancer, the following processing is tested. batch-service is a service I created. Request to /job/test_cron from ...
  • 61

1
2 3 4 5
20