These are chat archives for reactioncommerce/reaction

4th
Dec 2017
Josh Cox
@joshuacox
Dec 04 2017 03:54
@childproof the docs refer to installing xcode on a macintosh as this is a build requirement there, there is a section on linux on that same page that lists the requirements for a system using the apt package manager, where you will, most likely, not want to install xcode. And yes the meteor command does need to be updated as ReactionCommerce 1.6 was recently released which does use meteor 1.6 and not a 1.5 variant
Filip Wiśniewski
@speedingdeer
Dec 04 2017 10:45
Hi guys, 1.6 works very nice. Much faster now. I wonder if you can advice me one thing.
I wan to skip shipping method selection in my custom checkout (the digital product, key sent by email). Is it more like custom checkout plugin if I want to disable steps in checkout or I can still configure the checkout workflow to skip some steps?
Brandon Watson
@brandon-watson
Dec 04 2017 11:20
Please help me soon, I am going to add some functions to Dashboard, but I am not sure where I can modify the template to add functionality on template.
Michael Jenny
@prinzdezibel
Dec 04 2017 11:27
@brandon-watson sorry, could you please reiterate? Not sure about your question.
In any case: New functionality in dashboard means new plugin for sure.
Brandon Watson
@brandon-watson
Dec 04 2017 11:29
Yes.
Michael Jenny
@prinzdezibel
Dec 04 2017 11:29
And some settings in register.js
That should be enough to have it shown at least. (If I remember that right out of my head)
@speedingdeer not sure. I'd first try to adapt db's equivalent of /imports/plugins/core/checkout/register.js . (remove the shipping step) and then see what happens
Michael Jenny
@prinzdezibel
Dec 04 2017 11:34
(In Collection.Packages)
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:35
Hi @prinzdezibel thanks, I've done this
Michael Jenny
@prinzdezibel
Dec 04 2017 11:36
what happened?
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:36
and If I modify the registry config in DB
it gets stuck
I've changed order to skip step 3 and make step 4 to be step 3 etc
but apparently it's not about it
I've tried to disable different steps too but it never allows me to complete the order, always gets stuck
Michael Jenny
@prinzdezibel
Dec 04 2017 11:40
I've done that previously with an older version of Reaction. And I remember that I'd difficulties with pushCartWorkflow being called multiple times, which lead the program to run through all steps automatically. Do you fiddle with pushCartWorkflow at all?
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:44
oh I see
it feels like it's hardcoded
so it tries to jump to step which was deleted so never jumps to the next one
Michael Jenny
@prinzdezibel
Dec 04 2017 11:45
it's all about pushCartWorkflow
this method is a beast
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:46
Will add some debug there many thanks!
Wonder if it's a good workaround to replace the step to skip with empty one which does one thing - calls pushCartWorkflow to jump to next one
don't want to hardcode anything and detache from head
trying to work around everything with plugins
Michael Jenny
@prinzdezibel
Dec 04 2017 11:49
glad you asked. I did exactly this. even though it's a bit a hack
not sure I should share this piece of code :)
        if (cart.workflow.status === "checkoutValidate") {
          if (circuitOpen) {
            console.log("close circuit");
            circuitOpen = false;

            // set shippment method
            let shipmentMethod = ReactionCore.Collections.Shipping.findOne().methods[1];
            // Shipment method is a flat rate of 5 EUR.
            shipmentMethod.rate = "5.00";
            Meteor.call("cart/setShipmentMethod", cart._id, shipmentMethod);

            console.log("workflow/pushCartWorkflow checkoutAddressbook");
            Meteor.call("workflow/pushCartWorkflow", "coreCartWorkflow", "checkoutAddressBook");
            setTimeout(function(){
              console.log("reopen circuit");
              circuitOpen = true;
            }, 100);
          }
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:50
Thanks a lot
Michael Jenny
@prinzdezibel
Dec 04 2017 11:51
it's very old and I think it doesn't work anymore without adaptions
but generally I feel there's a cleaner way of accomplishing that
I just haven't tried lately
Filip Wiśniewski
@speedingdeer
Dec 04 2017 11:52
it feels like some parts are rewritten to deal with very flexible workflow and some are still hardcoded
will start from your code and see where it gets, it's fine if it's not working, it's about the concept
thanks a lot
Michael Jenny
@prinzdezibel
Dec 04 2017 11:55
In general I think I speak for most of us that we're not entirely happy with how workflows are implemented in Reaction. At least not everywhere. Some are very brittle. At least that is my gut feeling.
At one point we had a major workflow rewrite (2-3 years back). But if I remember correctly, cartWorfklow predates that.
Michael Jenny
@prinzdezibel
Dec 04 2017 12:11
@speedingdeer Host mi?
Realizing, you're from austria :)
Filip Wiśniewski
@speedingdeer
Dec 04 2017 12:12
no, not in Austria any more
Michael Jenny
@prinzdezibel
Dec 04 2017 12:12
speaking german?
Filip Wiśniewski
@speedingdeer
Dec 04 2017 12:12
the profile is outdated London and Poland now
only curse sometimes :)
Michael Jenny
@prinzdezibel
Dec 04 2017 12:13
great attitude !
Filip Wiśniewski
@speedingdeer
Dec 04 2017 13:55
@prinzdezibel can't figure it out, it feels difficult to skip shipping method
Michael Jenny
@prinzdezibel
Dec 04 2017 13:56
I'm going to look into it. meanwhile, go ahead..
Filip Wiśniewski
@speedingdeer
Dec 04 2017 13:57
thanks a lot
Michael Jenny
@prinzdezibel
Dec 04 2017 13:57
:thumbsup:
Filip Wiśniewski
@speedingdeer
Dec 04 2017 14:25
If I naively replace all coreCheckoutShipping by checkoutReview then edit the package database document to skip the shipping template it works
but it's super dirty hack - change things and see what happens
ideally I would only overwrite that shipping step to automatically jump on next one
not edit across the whole checkout plugin, impossible to maintain long term
Michael Jenny
@prinzdezibel
Dec 04 2017 15:47
@speedingdeer Agree, I was digging into it and found it too rigid/hardcoded. Entirely skipping the shipment does probably bring up problems in it's own, because the underlying data structures need to be set. (For invoicing, order processing, etc, etc.)
now this works:
// customize RC stock server method. skip shipment for digital goods.
Meteor.startup(() => {
  const original = Meteor.default_server.method_handlers["workflow/pushCartWorkflow"];
  function customized(workflow, newWorkflowStatus, cartId) {
    check(workflow, String);
    check(newWorkflowStatus, String);
    check(cartId, Match.Optional(String));
    if (workflow === "coreCartWorkflow" && newWorkflowStatus === "coreCheckoutShipping") {
      // push cart workflow twice and essentially skip shipping step
      original.call(this, "coreCartWorkflow", "coreCheckoutShipping", cartId);

      let currentCart;
      if (typeof cartId === "string") {
        currentCart = Cart.findOne(cartId);
      } else {
        currentCart = Cart.findOne({
          userId: this.userId
        });
      }

      let shipmentMethod = Reaction.Collections.Shipping.findOne().methods[0];
      Meteor.call("cart/setShipmentMethod", currentCart._id, shipmentMethod);
      newWorkflowStatus = "checkoutReview";
    }
    return original.call(this, workflow, newWorkflowStatus, cartId);
  }
  Meteor.default_server.method_handlers["workflow/pushCartWorkflow"] = customized;
But this is kind of ugly. I wish , I could find a better way of doing it. Maybe I'm missing something. But really, the workflow involves too much hard-coded stuff, IMHO.
you need to have at least one shipment flat rate defined. set it to 0.00
otherwise you'll experience what I've described earlier: Your workflow is running WILD.
Filip Wiśniewski
@speedingdeer
Dec 04 2017 15:50
did you paste this code as plugin
Michael Jenny
@prinzdezibel
Dec 04 2017 15:50
you can paste it anywhere.
but ideally, yes.
Filip Wiśniewski
@speedingdeer
Dec 04 2017 15:50
or you pasted it in some main.js ?
I see
no if I can use as plugin to cover the workaround it's great
wow
I've done something similar in my second attempt but I've hardcoded it and made it only worse I think
that's really great what you did
Josh Cox
@joshuacox
Dec 04 2017 16:15
Is everyone on windows using chocolatey? Anyone using the linux subsystem in win10? Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Josh Cox
@joshuacox
Dec 04 2017 16:30
It's kind of weird just running ubuntu directly onwindows
ragboy
@ragboy
Dec 04 2017 19:21
I have a group of devs working on reaction development. Every change made, then must be built/compiled before testing/checking the work. This is a slow and painful process. I am on a MBP 2016, fastest model and it takes me about 1 min to compile run. Most of the devs are not on machines as fast, and they usually take 2+ mins. That is a LOT of time spent waiting for compiling with every minor change that needs to be checked. Is there ANYTHING that can be tweaked to speed this up?
I have tried using a fast external mongodb server, offloading from the local system, and that made barely any impact.
Josh Cox
@joshuacox
Dec 04 2017 19:22
I dev inside a ramdisk (tmpfs) and that seems to improve the overall process by about 20~25%
Kenneth Beartusk
@beartusk
Dec 04 2017 19:24
Hey guys I’m trying to implement my own custom component, and I’m just trying to follow the examples in the documentation to get started. My setup shown below does not result in any observable changes though. Would someone be kind enough to point out what I’m doing wrong here?
image.png
image.png
image.png
the index.js's are empty at the moment
ragboy
@ragboy
Dec 04 2017 19:25
@joshuacox thanks, I will test that, but trying to avoid real complicated setups. How much are you allocating to the ramdisk?
Josh Cox
@joshuacox
Dec 04 2017 19:26
This is one of the reasons I brought up yarn a few days ago, I know that node8 is making strides at closing the performance gap there, it seems there are performance gains to be had. And I agree dev'ing on reaction can be quite wearisome when it becomes 'make a change', wait on reaction to recognize it and rebuild, or worse
tmpfs defaults to half of your ram, but it's important to note that is dynamically expanding and only consumes what is actually in the ramdisk at any point in time
ragboy
@ragboy
Dec 04 2017 19:27
Yes, and then thinking of debugging through painful issues in the future, I don't see there would ever be a way to step through the code.
@joshuacox got it.
Josh Cox
@joshuacox
Dec 04 2017 19:27
https://wiki.archlinux.org/index.php/tmpfs <-- the page I refer to when setting up a new tmp dir
ragboy
@ragboy
Dec 04 2017 19:27
we have dev'd in node before, but not with meteor. This is pretty painful. ;-)
00WhengWheng
@00WhengWheng
Dec 04 2017 19:28
what's the best practice to set up reaction.json?
I mean... the reaction.json.example doesnt feature the details for reaction-social that missing credentials (api key) for twitter google etc.... only just facebook one...
any suggestions for a full detailed reaction.json settings?
Filip Wiśniewski
@speedingdeer
Dec 04 2017 19:57
@prinzdezibel your code causes infinitive loop because cart/setShipmentMethod tried to push cart workflow twice too
Josh Cox
@joshuacox
Dec 04 2017 19:57
@beartusk it looks right on first inspection, but its hard to say for sure looking at pics, do you have the code in a repo somewhere so it can be looked at? As far as examples, there is the main example plugin, but there is also the hydrotik plugin especially the promo container
@00WhengWheng looking at the example you are correct, however, I think you can reverse engineer these using robomongo on a site where those values have been inserted
Josh Cox
@joshuacox
Dec 04 2017 20:30
And has anyone tried this linux subsystem in win10? I'm astounded, I've been using cygwin, or virtualbox VM, for serious *nix work in windows, but after installing the linux subsystem and firing up ubuntu, and installing meteor with ease ( it even serves on localhost port 3000 http://127.0.0.1:3000/ without issue). I'm left wondering why anyone would bother installing through chocolatey, mingW, cygwin, vbox, or any of the other methods?
so long as you are up to date (* if not, I have a reasonably fast laptop that spent 3 hours updating [ it was a neglected windows partition on a primarily linux machine]) it really is as simple as Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux in an admin powershell
Josh Cox
@joshuacox
Dec 04 2017 20:42
snag #1 docker doesn't actually run in this subsystem you still need a VM for that, but still very impressive
Aaron Judd
@aaronjudd
Dec 04 2017 20:53
@joshuacox @ragboy I think as we move forward with performance related/cleanup tasks, one of the first things I’d like to see is us move all non-required packages to optional installation as packages. although I’ve not looked into it depth, my gut is that there is also some compilation optimization that can be done for CSS/less etc as well. While node8/npm upgraded with Meteor 1.6 -> I don’t think the build tooling really got that much of an update. (although everything should still be faster).
regarding research, anybody have experience with Gatsbyjs? any pros/cons to share?
Sophie He
@sophiehe
Dec 04 2017 21:00
Hi all! Tomorrow is our Reaction Action livestream. We'll be showing demos of our marketplace functionality, higher order components in React + more! It's not too late to RSVP to tomorrow's Reaction Action livestream: getrxn.io/reaction-action-dec 🙌
Josh Cox
@joshuacox
Dec 04 2017 21:21
@aaronjudd the move to node 8 has improved things greatly, though I think that most of these improvements have been during the development bootstrap processes (reading package.json and verifying the node_modules dir, etc), which is where I would think a ramdisk would be most beneficial (but it's not a million times faster by any means). So far as production performance, my biggest fear is of users closing the browser session before the meteor initial lump can be swallowed. I'd still like to see the background, header/footer, and a spinner in the middle while that is downloading, but I am still interested in that lump being broken up into smaller pieces.
Kenneth Beartusk
@beartusk
Dec 04 2017 21:26
@joshuacox My code is on a private repository for our company, but I grabbed the plugin folder and placed it in a public repo so you can see it at git@github.com:beartusk/Reaction-Plugin-Testing.git
Josh Cox
@joshuacox
Dec 04 2017 21:38
@beartusk I'm not certain of what might be wrong with your method of importing and using Component.brand like that. Take a look at that promo container in the hydrotik plugin, that's the method that worked for me YMMV
Benedikt Berger
@bergben
Dec 04 2017 22:12
Hey guys! can reaction also be used with angular or vue? :)
CF
@ChenfengLiu
Dec 04 2017 22:28
Hi guys, I'm trying to deploy Reaction to Google Kubernetes Engine. I have pushed my docker image to Dockerhub and created a cluster using command gcloud container clusters create reactioncluster. And how do I set the ROOT_URL and MONGO_URL when I deploy my docker image? (or do I need to set them?)
CF
@ChenfengLiu
Dec 04 2017 22:46
And sorry that I'm really new to docker and kubernetes... what will the ROOT_URL and MONGO_URL be when I'm just running my docker image locally?
Aaron Judd
@aaronjudd
Dec 04 2017 23:05
@ChenfengLiu we use docker, kubernetes for production deployment, and those are passed as ENV variables. for local development, just reaction will run meteor and all the dependencies, mongodb, etc you need locally.
Josh Cox
@joshuacox
Dec 04 2017 23:07
@ChenfengLiu have you seen my helm chart? Feel free to make issues, PRs, etc there. There is also a forum post where I welcome discussion about kubernetes in general. In my case, the MONGO_URL is created by this line in the configmap. And ROOT_URL is set by default by this line which you can also set upon install like so helm install --set reactionRoot_url=my.url.com ./reactionetes
Aaron Judd
@aaronjudd
Dec 04 2017 23:08
@joshuacox while dynamic loading of components, etc would probably take care of that “initial” load -> and with other optimizations and loaders, cdn images, a mid volume site should perform well in production. for more performance, I’ve been thinking a lot about static site generation + react + graphql, as a possibility for a super fast / volume solution.
Josh Cox
@joshuacox
Dec 04 2017 23:11
@aaronjudd I love the idea of a static front-end, I've been toying around with having the CSV importer from dhonig also make a jekyll site ( though I'm not stuck on jekyll ), in addition it would be nice to have some sort of common theme ground there where themers could experiment with front-end without invoking the reaction/meteor bootstrap
and to be clear I didn't modify the importer at all I was just looping through the CSV lines and creating pages
Aaron Judd
@aaronjudd
Dec 04 2017 23:19
holiday prototyping: gatsby + react (and hopefully reaction react components, made universal) + our reaction-api-base graphql.
Brandon Watson
@brandon-watson
Dec 04 2017 23:32
Hi Guys.
How can I add some custom items to dashboard side bar?
Josh Cox
@joshuacox
Dec 04 2017 23:33
@brandon-watson by creating a custom plugin
Brandon Watson
@brandon-watson
Dec 04 2017 23:35
after I made plugin, I should import that plugin on dashboard client and server?
Josh Cox
@joshuacox
Dec 04 2017 23:36
@brandon-watson I'm not certain I understand your question. the plugin goes into imports/plugins/custom in the reaction directory.
Brandon Watson
@brandon-watson
Dec 04 2017 23:37
So you mean that I should make the plugin in imports/plugins/customdirectory, then it will be displayed on dashboard list?
Josh Cox
@joshuacox
Dec 04 2017 23:37
@aaronjudd gatsby looks perfect!
Brandon Watson
@brandon-watson
Dec 04 2017 23:38
@joshuacox
Josh Cox
@joshuacox
Dec 04 2017 23:38
@brandon-watson given that you implement that sort of thing, perhaps look at the shopify connector
Brandon Watson
@brandon-watson
Dec 04 2017 23:40
@joshuacox , I am just new at reaction. could you just give me some hint or I am wrong or right?
machiko
@machikoyasuda
Dec 04 2017 23:41
@brandon-watson the plugin tutorial is a good place to start for people new to reaction: https://docs.reactioncommerce.com/reaction-docs/master/plugin-creating-2
Josh Cox
@joshuacox
Dec 04 2017 23:41
@brandon-watson you are correct, in that you can implement custom solutions that will end up on the dashboard using a plugin
Brandon Watson
@brandon-watson
Dec 04 2017 23:42
Okay, thanks.
@joshuacox