saga | Next-generation ecommerce framework built with Node.js | Server Side Rendering library
kandi X-RAY | saga Summary
kandi X-RAY | saga Summary
Next-generation ecommerce framework built with React and GraphQL.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of saga
saga Key Features
saga Examples and Code Snippets
Community Discussions
Trending Discussions on saga
QUESTION
How to publish two messages of the same type to different worker instances based on the message content without using Send and RequestAddress?
My scenario is:
I am using Azure ServiceBus and Azure StorageTables.
I am running two different instances of the same worker service workera and workerb. I need workera and workerb to both consume messages of type Command based on the value of Command.WorkerPrefix.
the Command type looks like:
...ANSWER
Answered 2021-Jun-15 at 23:37Using MassTransit with Azure Service Bus, I would suggest taking the message routing burden away from the publisher, and moving it to the consumer. By configuring the receive endpoint and using a subscription filter each instance would add its own subscription and use a message header to filter published messages.
On the publisher, a message header would be added:
QUESTION
I created an App with some components and using the redux-saga in the following component:
...ANSWER
Answered 2021-Jun-13 at 17:29To me it looks like a typo, handleGetUsers
vs handleGetUser
:)
QUESTION
I tried to install sass-loader to compile scss, but it shows a version compatibility error. I downgrade the version and did so many things, but still shows the same issue.
React version- 17.0.2 node version- 16.2.0 npm version - 7.13.0
Package.json
...ANSWER
Answered 2021-Jun-11 at 14:52The error seems to come from a version of sass-loader
that doesn't handle node-sass@6
.
It has been fixed in sass-loader@11.1.0
by this pull request.
Also note that if you use node@16
, you will have to use node-sass@6
(see node-sass version policy)
To sum up: You can use node-sass@6
given you also install a recent sass-loader
version.
QUESTION
I have to pretty weird case to handle.
We have to few boxes, We can call some action on every box. When We click the button inside the box, we call some endpoint on the server (using axios
). Response from the server return new updated information (about all boxes, not the only one on which we call the action).
Issue: If user click submit button on many boxes really fast, the request call the endpoints one by one. It's sometimes causes errors, because it's calculated on the server in the wrong order (status of group of boxes depends of single box status). I know it's maybe more backend issue, but I have to try fix this on frontend.
Proposal fix:
In my opinion in this case the easiest fix is disable every submit
button if any request in progress. This solution unfortunately is very slow, head of the project rejected this proposition.
What we want to goal: In some way We want to queue the requests without disable every button. Perfect solution for me at this moment:
- click first button - call endpoint, request pending on the server.
- click second button - button show spinner/loading information without calling endpoint.
- server get us response for the first click, only then we really call the second request.
I think something like this is huge antipattern, but I don't set the rules. ;)
I was reading about e.g. redux-observable
, but if I don't have to I don't want to use other middleware for redux
(now We use redux-thunk
). Redux-saga
it will be ok, but unfortunately I don't know this tool. I prepare simple codesandbox example (I added timeouts in redux
actions for easier testing).
I have only one stupid proposal solution. Creating a array of data needs to send correct request, and inside useEffect
checking if the array length is equal to 1. Something like this:
ANSWER
Answered 2021-Jun-10 at 21:53I agree with your assessment that we ultimately need to make changes on the backend. Any user can mess with the frontend and submit requests in any order they want regardless how you organize it.
I get it though, you're looking to design the happy path on the frontend such that it works with the backend as it is currently.
It's hard to tell without knowing the use-case exactly, but there may generally be some improvements we can make from a UX perspective that will apply whether we make fixes on the backend or not.
Is there an endpoint to send multiple updates to? If so, we could debounce our network call to submit only when there is a delay in user activity.
Does the user need to be aware of order of selection and the impacts thereof? If so, it sounds like we'll need to update frontend to convey this information, which may then expose a natural solution to the situation.
It's fairly simple to create a request queue and execute them serially, but it seems potentially fraught with new challenges.
E.g. If a user clicks 5 checkboxes, and order matters, a failed execution of the second update would mean we would need to stop any further execution of boxes 3 through 5 until update 2 could be completed. We'll also need to figure out how we'll handle timeouts, retries, and backoff. There is some complexity as to how we want to convey all this to the end user.
Let's say we're completely set on going that route, however. In that case, your use of Redux for state management isn't terribly important, nor is the library you use for sending your requests.
As you suggested, we'll just create an in-memory queue of updates to be made and dequeue serially. Each time a user makes an update to a box, we'll push to that queue and attempt to send updates. Our processEvents
function will retain state as to whether a request is in motion or not, which it will use to decide whether to take action or not.
Each time a user clicks a box, the event is added to the queue, and we attempt processing. If processing is already ongoing or we have no events to process, we don't take any action. Each time a processing round finishes, we check for further events to process. You'll likely want to hook into this cycle with Redux and fire new actions to indicate event success and update the state and UI for each event processed and so on. It's possible one of the libraries you use offer some feature like this as well.
QUESTION
I am removing some very intertwined global state from a new app (redux/sagas/selectors), to -> context api and react-query. There are tons of selectors integrated into this "global state", that is now needing to be refactored. I've only put a few, co-locating them with the mutations that generate the required data. BUT --
What are your strategies of using "selectors" with react-query?
Where are you locating these selectors, in the component folder or in a "selectors" folder, or sitting within the react-query useQuery in which the data is derived?
So, just to be clear, I am using the new react-query selector functionality. My legacy APP has selectors globally & in the components proper, and I am not sure that is the clearest way.. also, especially if I have a useQuery wrapper sitting globally... just trying to sort out the architecture here.
Any help is appreciated.
Note: I guess we could have a "selectors" file (co-located) with the feature, but do we then import the useQuery hook I have and just do it there.. in a "selectors.ts" file IN the feature folder it is used in..... OR move the selectors INTO the useQuery wrapper hook file.
- What if these selectors are feature dependent (no other feature/part of the is gonna need them?).
- What if these selectors can be used globally?
Strategies?
...ANSWER
Answered 2021-Jun-09 at 10:59I personally try to keep as little things as possible global - mostly things co-located within a certain feature. If something really needs to be accessible everywhere in the app, it's likely it's own feature. If there is a single query that needs to be used in multiple features, I do have a top level queries
directory where they are, but there is really not much in there.
As for selectors: I inline them in the useQuery hook, if I need them more than once, I extract them to a function, and if that's get out of hand, I put them in a separate file next to the queries, like:
QUESTION
I want to wrap my project in a redux store. I do not wish to use it in react admin, only in the rest of my project.
I'm just using the usual redux provider code in my src/index.js file:
...ANSWER
Answered 2021-Jun-03 at 18:56You can separate the two applications, each with their own routes and redux provider.
QUESTION
I have the following saga effect:
...ANSWER
Answered 2021-Jun-02 at 14:52You are using race
wrong way. You can fix like this:
QUESTION
our redux-saga generator contains multiple yield statements, that return different results. I need help typing them properly.
Here's an example:
...ANSWER
Answered 2021-Jun-03 at 03:27It seems like you are definitely guilty of some over-typing here. Certainly yield Network.get()
returns a Business
, right? You shouldn't have to write const businessDetails: Business
if the value that you are assigning to it is a Business
.
These generator return types can be really hard to type properly, but Typescript is smart enough to figure out the proper type. You could leave it off entirely and it would be fine. If you've having a hard time figuring out the correct type you can delete the return type temporarily to see what the inferred type is. That's how I resolved your first issue, which is that that the union Business | BusinessesContainer
needs to be changed to an intersection Business & BusinessesContainer
.
I don't know what the ActionPayload
type is but it seems unnecessary. You are typing the payload of your put
action as ActionPayload>
, but Array
is correct on its own. There's no reason for the payload
to be optional when you are always providing it.
Those two changes solve your typescript issues...for now. I usually see API calls executed inside a call
effect, which would make the types even more complex. But I'm not sure if the call
is actually required.
QUESTION
I'm having problems creating my angular project, I've already tried updating @angular / core tried to delete a node modules folder and install again I changed the version of my node and npm Nothing works
This is the error [1]: https://i.stack.imgur.com/FdywP.png
This is my tsconfig.json
...ANSWER
Answered 2021-Jun-01 at 12:46Fixed the issue by installing codelyzer globally
npm install -g codelyzer
I deleted node_modules
and installed it again with
npm install
QUESTION
I'm using NServiceBus with SQL Persistance and MSSQL Server.
I want to be sure that I don't get invalid data in my database in high concurrent scenarios.
From the docs I know that the SQL persister uses pessimistic concurrency since version 4.1.1. But I'm not sure how it works exactly because under "Starting Saga" and "Changes to Saga state" only optimistic concurrency is mentioned.
Does each saga instance only handle one message at a time and all the remaining messages are waiting in the queue to be handled by the saga?
Also is it possible to configure the concurrency to use optimistic concurrency instead of pessimistic concurrency for the SQL persister?
...ANSWER
Answered 2021-Jun-01 at 07:03Both optimistic concurrency control and pessimistic locking result in a saga instance to only being able to handle 1 message.
Might multiple messages be handled then with :
Optimistic concurrency control: The 2nd+ writer will fail and the message will be retried.
Locking: THe lock ensures that multiple messages on the same saga instance will be delayed. Sometimes this can result in a deadlock due to lock escalation and then the message will be retried.
Regarding pessimisitic vs optimistic, you cannot choose. The latest version uses pessimistic locking. See https://docs.particular.net/persistence/sql/saga-concurrency:
Starting in version 4.1.1 conflicts cannot occur because the persistence uses pessimistic locking. Pessimistic locking is achieved by performing a SELECT ... FOR UPDATE or its dialect-specific equivalent.
Up to and including version 4.1, SQL persistence uses optimistic concurrency control when updating or deleting saga data.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install saga
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page