profile
viewpoint

dandlezzz/active_conformity 13

Database driven validations

dandlezzz/pg_flash_json 5

json from postgres in a flash!

dandlezzz/attribute_will_change_bug 2

working on an attribte_will_change bug in rails 4.2

dandlezzz/ember-cli-deploy 2

A deployment pipeline for Ember CLI apps

dandlezzz/ember-data-factory-guy 2

Factories for testing with Ember Data

dandlezzz/active_mocker 0

Create mocks from active record models without loading rails or running a database.

dandlezzz/cheerio 0

Fast, flexible, and lean implementation of core jQuery designed specifically for the server.

issue commentredux-form/redux-form

Error when Field comes from external package

Hi, I managed to solve this issue by removing it from dependencies in external package and adding it to devDependencies and peerDependencies in package.json file, then after installing your external package to the application you will have to install redux-form to that application separately but will solve the issue.

gsnunes

comment created time in 5 hours

PR opened solidusio/solidus

Remove deprecated sass color-#{state} variables usage Needs Backport

Description

This is a preparatory PR for #3816 and needs backport.

With 9552cccd3e825f9bf3fe9c1f1df0b4a4da72c23e we deprecated the following variables in favor of their boostrap counterpart:

Deprecated New
$color-success theme-color(success)
$color-notice theme-color(warning)
$color-error theme-color(danger)

This PR is quite complex because we were using these deprecated variables in variables.scss itself and we can't just use swap them to the new version since when this file is imported we didn't import the Boostrap file yet. And there's a reason for that: we define Boostrap colors using the variables defined in variables.scss. 🤯

I propose to move the actions related variable in the already existing actions.scss file, so that we can define them later, after Boostrap files have been loaded.

We preserved the ability to customize those variables per store because they will be still loaded after the variables_override.scss file.

There's some slight visual change in the colors, due to using the boostrap built-in theme-color-level() function, instead of sass lighten():

Flash Messages

Screenshot 2020-12-03 at 18 15 06 |

Table rows with highlighted colors

Success Warning Danger
Screenshot 2020-12-03 at 16 47 33 Screenshot 2020-12-03 at 16 47 49 Screenshot 2020-12-03 at 16 47 59

Checklist:

  • [x] I have followed Pull Request guidelines
  • [x] I have added a detailed description into each commit message
  • [x] I have attached screenshots to this PR for visual changes (if needed)
+76 -39

0 comment

6 changed files

pr created time in 17 hours

issue openedredux-form/redux-form

'Maximum update depth exceeded' when passing 'validate' param of Field as a function that not stored in a variable

Subject of the issue

When passing 'validate' param of Field as a function that not stored in a variable we get infinite loop of updates.

Your environment

Software Version(s)
redux-form 8.3.7
redux 4.0.5
react-redux 7.2.2
react 17.0.1
react-dom 17.0.1
node 12.18.2
yarn if using 1.22.10
Browser Chrome
Operating System Windows 7

Steps to reproduce

You can reproduce this bug by visiting my sandbox.

created time in 20 hours

Pull request review commentsolidusio/solidus

Remove all code deprecated in Solidus v2.x

 # frozen_string_literal: true +require 'active_support'

Not sure to understand why it was working before this change, did you get that? Also, please use a permalink in the commit otherwise that file could change in the future and not point anymore to the right line.

kennyadsl

comment created time in 2 days

Pull request review commentsolidusio/solidus

Remove Spree::UserAddress#archived flag

+class RemoveArchivedUserAddresses < ActiveRecord::Migration[6.0]

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

mamhoff

comment created time in 3 days

Pull request review commentsolidusio/solidus

Remove Spree::UserAddress#archived flag

 class UserAddress < Spree::Base     belongs_to :address, class_name: "Spree::Address", optional: true      validates_uniqueness_of :address_id, scope: :user_id-    validates_uniqueness_of :user_id, conditions: -> { active.default_shipping }, message: :default_address_exists, if: :default?+    validates_uniqueness_of :user_id, conditions: -> { default_shipping }, message: :default_address_exists, if: :default?      scope :with_address_values, ->(address_attributes) do       joins(:address).merge(         Spree::Address.with_values(address_attributes)       )     end -    scope :all_historical, -> { unscope(where: :archived) }     scope :default_shipping, -> { where(default: true) }     scope :default_billing, -> { where(default_billing: true) }-    scope :active, -> { where(archived: false) }++

Layout/EmptyLines: Extra blank line detected.

mamhoff

comment created time in 3 days

PR opened solidusio/solidus

Remove Spree::UserAddress#archived flag

Description <!-- This flag is not very useful and gives rise to bugs.

It is not very useful, as we only need it to "resurrect" addresses that the user inputs newly, but that match an address that has been removed from the address book in the past for some reason. Why not remove the join table entry directly? Much simpler, and less code to worry about.

The bug we found that exists only because of the existence of this column is the following: If an address is added to the address book that matches an existing user address that is archived, there is a chance of it throwing a uniqueness validation error, because the uniqueness check on user/address on the Spree::UserAddress model does not take into account the "archived" flag.

The third reason why I think this should go is for data protection reasons: If I call "delete" on a record, I want it to be gone, not half-gone. And in the case of a join table representing which addresses a user wants to be presented with again, I very much want it gone.

Not archived.

Note also: Removing this complexity removes explanatory comments in otherwise straight-forward API endpoints. -->

Checklist:

  • [x] I have followed Pull Request guidelines
  • [x] I have added a detailed description into each commit message
  • [x] I have updated Guides and README accordingly to this change (if needed)
  • [x] I have ~added~ removed tests to cover this change
+27 -96

0 comment

5 changed files

pr created time in 3 days

issue commentredux-form/redux-form

how we can use redux-form with hooks

Thank you so much that helps a lot

usman786-ctrl

comment created time in 3 days

issue commentredux-form/redux-form

how we can use redux-form with hooks

Use the getFormValues selector (docs)

import { useSelector } from 'react-redux';
import { getFormValues } from 'redux-form';

// then

const formValues = useSelector(state => getFormValues('formName')(state))
usman786-ctrl

comment created time in 3 days

issue openedredux-form/redux-form

FieldInputProps type doesn't actually cause desired errors when missing value prop for type: 'radio'

I plugged this simplified example into Try Flow. No errors:

// @flow

type FieldTypeProps = {
  type: 'radio',
  value: any, // mandatory iff type === 'radio'
} | {
  type?: string,
}

type Props = {
  name: string,
  props?: Object,
  type?: string,
} & FieldTypeProps

const p: Props = {name: 'foo', type: 'radio'} // should error that value is missing, but doesn't

The issue here is really just that {type?: string} wins, but I've never trusted using & on object types. It's given me a lot of tricky issues in the past. I think we should just use a simple flat shape type for FieldInputProps.

created time in 3 days

issue commentredux-form/redux-form

Export all flow type aliases from root

I'll try to make a PR for this soon

jedwards1211

comment created time in 3 days

issue openedredux-form/redux-form

Export all flow type aliases from root

We need to be able to use all of them in userland, absolutely any type alias declared anywhere in the flow type defs.

import type { FieldInputProps, FieldArrayInputProps, Validator /* etc */ } from 'redux-form'

created time in 3 days

pull request commentsolidusio/solidus

Migrate default billing addresses to address book

Hey @ikraamg thank you - However, for a very large Solidus installation, this will be prohibitively slow. I've purposefully set this to run in pure SQL, and I'm sure it's possible to do this without iterating over ActiveRecord collections. Sometime this week :)

mamhoff

comment created time in 4 days

issue commentredux-form/redux-form

clearFields doesn't clear field value

I have fixed this with a workaround with the help of useState 👍 firstly define a state veriable const [submitSucceededState, setSubmitSucceededState] = useState(false) in your form component.

then change your form's return like below

return (<form onSubmit={handleSubmit(formSubmit)}> {submitSucceededState && <Alert color="success" text="your message here." />} <Field component={renderField} label="Username" name="username" type="text" placeholder="Username" /> <Button color="primary" disabled={submitting} className="btn-block">Sign Up</Button> </form>)

the last piece of the code block is just for defining the formSubmit function.

lastly, put the below code into your function based component. const formSubmit = () => { if (submitSucceeded) { setSubmitSucceededState(true) reset() } }

in this way, after making successful form submission, you save the successful result in a state. Then reset your form. If you want to use this result somewhere you can use your state in your component or transfer it via props.

lynkx

comment created time in 6 days

pull request commentsolidusio/solidus

Migrate default billing addresses to address book

Hi, this is a great bug catch 🐛 👍 . below I have a suggestion in order to account for any codebase that already uses the default_billing, should correctly be able to migrate and rollback

mamhoff

comment created time in 6 days

Pull request review commentsolidusio/solidus

Improve payment service providers switching errors

 You would need to extend or rewrite this class with your preferred PSP integration.  [credit-card-base]: https://github.com/solidusio/solidus/blob/master/core/app/models/spree/payment_method/credit_card.rb++### Switching payment service provider++After switching payment service provider, there may be `Spree::PaymentMethod` +records referencing a `type` class that does not exist anymore.+

Nice suggestion, I didn't consider it at first. I just added it.

luca-landa

comment created time in 7 days

Pull request review commentsolidusio/solidus

Improve payment service providers switching errors

+# frozen_string_literal: true++namespace :payment_method do+  desc "Deactivates old payment methods and fixes ActiveRecord::SubclassNotFound error, "\+  "which happens after switching Payment Service Provider."+  task deactivate_unsupported_payment_methods: :environment do+    Spree::PaymentMethod.pluck(:id, :type).select do |id, type|+      begin+        ActiveSupport::Dependencies.constantize(type)+      rescue NameError+        fix_payment_method_record(id, type)+      end+    end+  end++  def fix_payment_method_record(id, previous_type)+    connection = ActiveRecord::Base.connection+    false_value = connection.quoted_false+    connection.exec_update(<<-SQL+      UPDATE spree_payment_methods+      SET type='#{Spree::PaymentMethod.name}', previous_type='#{previous_type}',+      active=#{false_value}, available_to_users=#{false_value}, available_to_admin=#{false_value}

Fixed it, actually it was a bit ugly before.

luca-landa

comment created time in 7 days

Pull request review commentsolidusio/solidus

Improve payment service providers switching errors

+# frozen_string_literal: true++class AddPreviousTypeToSpreePaymentMethods < ActiveRecord::Migration[5.2]+  def change+    add_column :spree_payment_methods, :previous_type, :string

It sounds better actually, fixed.

luca-landa

comment created time in 7 days

issue commentsolidusio/solidus

Rails 6.1 compatibility

Ransack main branch is now compatible with Rails 6.1.0.RC1 ❤️

elia

comment created time in 7 days

issue commentsolidusio/solidus

Rails 6.1 compatibility

We have a problem with CanCanCan too: undefined method 'resolve_column_aliases' for`, but it has already been addressed here

elia

comment created time in 7 days

issue closedredux-form/redux-form

404 error when jump straight from main page to Example

Hi. When I try to jump from the main page (https://redux-form.com/8.3.0/) to example page - I got a 404 error.

closed time in 7 days

AnakenRalf

issue openedredux-form/redux-form

404 error when jump straight from main page to Example

Hi. When I try to jump from the main page (https://redux-form.com/8.3.0/) to example page - I got a 404 error.

created time in 7 days

issue openedredux-form/redux-form

TypeError: this.props.onBlur is not a function

Hi, i am trying to use redux form for my private implementation of multiselect

i have two issues:

  1. follow the example https://redux-form.com/6.0.0-rc.1/examples/react-widgets/ I am getting × TypeError: this.props.onBlur is not a function
  2. removing the onBlur i didn't get the updated values in my form redux state

code: MultiSelect.js `import React from 'react'; import _ from "lodash"

import Dropdown from './Dropdown';

class MultiSelect extends React.Component { // state showing if dropdown is open or closed state = {dropdown: false, items: ['john', 'milos', 'steph', 'kathreine'], selectedItems: []}

toogleDropdown = (e) => {
    this.setState((prevState) => ({
        dropdown: !prevState.dropdown
    }));
};
// adds new item to multiselect
addTag = (item) => {
    this.setState((prevState) => ({
        selectedItems: prevState.selectedItems.concat(item)
    }));
    this.setState({dropdown: false})
};
// removes item from multiselect
removeTag = (item) => {
    const filtered = this.state.selectedItems.filter((e) => e !== item);
    this.setState({selectedItems: filtered})

}

renderItem = (tag, index) => {
    return (
        <div key={index}
             className="flex justify-center items-center m-1 font-medium py-1 px-2 bg-white rounded-full text-teal-700 bg-teal-100 border border-teal-300 ">
            <div className="text-xs font-normal leading-none max-w-full flex-initial">{tag}</div>
            <div className="flex flex-auto flex-row-reverse">
                <div onClick={() => this.removeTag(tag)} >
                    <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="none"
                         viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2" strokeLinecap="round"
                         strokeLinejoin="round"
                         className="feather feather-x cursor-pointer hover:text-teal-400 rounded-full w-5 h-5 ml-2">
                        <line x1="18" y1="6" x2="6" y2="18"></line>
                        <line x1="6" y1="6" x2="18" y2="18"></line>
                    </svg>
                </div>
            </div>
        </div>)
}

renderSelectedItems = () => {
    return this.state.selectedItems.map((tag, index) => this.renderItem(tag, index));
}

renderDropdown = (remainItems)=>{
    if(this.state.dropdown) {
        return (<Dropdown list={remainItems} addItem={this.addTag}></Dropdown>);
    }else{
        return null
    }

}
renderMultiSelect = (input) => {
    const remainItems = _.difference(this.state.items, this.state.selectedItems)
    return (<div className="autcomplete-wrapper">
        <div className="autcomplete">
            <div className="w-full flex flex-col items-center mx-auto">
                <div className="w-full">
                    <div className="flex flex-col items-center relative">
                        <div className="w-full ">
                            <div className="my-2 p-1 flex border border-gray-200 bg-white rounded ">
                                <div className="flex flex-auto flex-wrap">
                                    {this.renderSelectedItems()}
                                    <div className="flex-1">
                                        <input {...input} placeholder=""
                                               className="bg-transparent p-1 px-2 appearance-none outline-none h-full w-full text-gray-800"
                                               autoComplete="off"
                                        />
                                    </div>
                                </div>
                                <div
                                    className="text-gray-300 w-8 py-1 pl-2 pr-1 border-l flex items-center border-gray-200"
                                    onClick={this.toogleDropdown}>
                                    <button
                                        type="button"
                                        className="cursor-pointer w-6 h-6 text-gray-600 outline-none focus:outline-none">
                                        <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"
                                             fill="none"
                                             viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2"
                                             strokeLinecap="round" strokeLinejoin="round"
                                             className="feather feather-chevron-up w-4 h-4">
                                            <polyline points="18 15 12 9 6 15"></polyline>
                                        </svg>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    {this.renderDropdown(remainItems)}
                </div>
            </div>

        </div>
    </div>);

};

// const {globalLayout, name, layout, type, readonly} = this.props;
// const layoutToUse = (layout ? layout : globalLayout)
// return (
//     <Field name={name}
//            label={this.convertUnderScoreSentenceCase(name)}
//            component={renderInput}
//            type={type}
//            readonly={readonly}
//     />
// );

render() {
    const {input, label, meta, type, onChange} = this.props;
    // input.onChange = (value) => {
    //     console.log("onChange", value)
    //     console.log("onChange", this.state.selectedItems)
    //     return input.onChange(this.state.selectedItems)
    // }
    // input.onBlur = () => input.onBlur([...input.value])
    return (

        <div className="relative w-full mb-3">
            <label
                className="block uppercase text-gray-700 text-xs font-bold mb-2"
                htmlFor="grid-password"
            >
                {label}
            </label>


            {this.renderMultiSelect(input)}
        </div>
    );
}

}

export default MultiSelect;`

field multiselect.js `import React from 'react';

import {Field, change as changeFieldValue} from "redux-form"; import FormField from "./FormField"; import MultiSelect from "./MultiSelect";

class FormFieldMultiSelect extends FormField {

// onChange = function(event, newValue, previousValue, name) {
//     this.props.dispatch(changeFieldValue('myFormName', 'anotherField', 'value'));
// }

render() {
    const {globalLayout, name, layout, type} = this.props;
    const layoutToUse = (layout ? layout : globalLayout)
    return (
        <div className={`w-full lg:w-${layoutToUse} px-4`}>
            <Field name={name}
                   label={this.convertUnderScoreSentenceCase(name)}
                   component={MultiSelect}
                   type={type}
                   onBlur={() => this.props.onBlur()}
                   defaultValue={[]}

                // onChange={(value) => {return props.input.onChange(value.map(p => p.value))}}
                   // onBlur={() => props.input.onBlur([...props.input.value])}
                   // options={props.options}
                   // multi={true}
            />
        </div>
    );
}

}

export default FormFieldMultiSelect;`

the component works fine by without updating the redux state: image

created time in 7 days

PR opened solidusio/solidus

Remove the gray border inside a product image

It wasn't visible, since there is the gray border applied by CSS, around every product image. Inside the Polo image there was an unwanted extra gray border, now removed. ruby_polo_back ruby_polo

+0 -0

0 comment

2 changed files

pr created time in 7 days

push eventsolidusio/solidus

andrea longhi

commit sha 15e172e314b4d8d94ad6ab9123da8b3bc4556165

Avoid `#method` shadowing Ruby already defines the method `#method`, so variables and parameters are renamed in order to avoid shadowing that method.

view details

Alessandro Desantis

commit sha 47dacbad7b7d056058dc78a3cc8da45334da0a2e

Merge pull request #3846 from nebulab/spaghetticode/shadow-method Avoid `#method` shadowing

view details

push time in 7 days

PR merged solidusio/solidus

Avoid `#method` shadowing

Ruby already defines the method Object#method, so variables and parameters are renamed in order to avoid shadowing that method.

Description <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Please include screenshots in case of visual changes to the frontend or backend sections of Solidus.

If needed you can reference another PR or issue here, e.g.: Ref #ISSUE -->

Checklist:

+11 -11

0 comment

3 changed files

spaghetticode

pr closed time in 7 days

push eventsolidusio/solidus

Alberto Vena

commit sha fda94c562361396bdf2370180723dbb30f596034

Fix use_legacy_address_state_validator deprecation message To activate the new behavior the value should be false, not true.

view details

Alberto Vena

commit sha faa74228d90c584db7383b827d40d3472e0ce1c9

Merge pull request #3845 from nebulab/kennyadsl/fix-deprecation-message Fix use_legacy_address_state_validator deprecation message

view details

push time in 7 days

PR merged solidusio/solidus

Fix use_legacy_address_state_validator deprecation message Needs Backport

To activate the new behavior the value should be false, not true.

+1 -1

0 comment

1 changed file

kennyadsl

pr closed time in 7 days

push eventsolidusio/solidus

Ruben O. Chiavone

commit sha c7b39a6123862cc5a19d2ea2d0579b6d4e1b0658

Rename all occurrences of emails with spree username to solidus

view details

Ruben O. Chiavone

commit sha 4c61792651793b198557cac72d8010831dc9e69d

Rename domain name from spreecommerce.com to solidus.io on emails

view details

Alberto Vena

commit sha 1dfc78c7ac64276e6c7641cf6e9112fc545721ab

Merge pull request #3849 from rubenochiavone/rename_emails_with_spree_username Rename all occurrences of emails with spree username to solidus

view details

push time in 7 days

more