Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVS! HELP US TEST ASAP. #1337

Closed
dovy opened this issue Jun 10, 2014 · 34 comments
Closed

DEVS! HELP US TEST ASAP. #1337

dovy opened this issue Jun 10, 2014 · 34 comments

Comments

@dovy
Copy link
Contributor

dovy commented Jun 10, 2014

Hey WordPress devs. As if our last release wasn't enough, I just reduced load time of the panel by up to 300%! I need you to help me test ASAP.

** It's been merged into master **

Grab it. Tell us if you have problems. I don't think you will though. Did I mention, this work will dramatically help us get groups out too? Oh yea. That's forthcoming.

If you can, donate to the effort (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=N5AD7TSH8YA5U). Some of us have bills to pay and we're spending way too much time making your dev life easier.

Some have asked what we did differently?

We made the JavaScript on-demand. Traditionally we initialized every field in the panel on load. This took a lot of time. Certain JS functions (like the WP color picker, editor, ace_editor, etc) took a LONG time to load. By doing it the way we are, only the fields visible at any time are initialized. As you traverse your panel fields that are newly visible get initialized. In this way you load the full panel without having to launch javascript for fields you never see or use. I think you're users will b every VERY happy.

Please test this hard. Every field. GO!

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

it says "redux is not defined" on the chrome dev tools javascript console?

@kprovance
Copy link
Member

You of all people should know better than to leave one liners that really tell us nothing.

@dovy
Copy link
Contributor Author

dovy commented Jun 11, 2014

Heh. More details please? Maybe a config gist?

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

Hey kevin, hey dovy, I downloaded the latest version and integrated to my test system, I compared the latest barebone-config.php with my custom config.php, and they were the same except my custom values, I think any of the fields in my config are initializing the "redux" variable (not the "$.redux" one).
where do you initialize this variable? Since it's a javascript issue, and my sections config file is not a complicated one, I thought this info will be enough.

Here's the error log of mine:

Uncaught ReferenceError: redux is not defined field_media.js?ver=1402465855:13
Uncaught ReferenceError: redux is not defined field_switch.js?ver=1402465855:13
Uncaught ReferenceError: redux is not defined field_select.js?ver=1402465855:6
Uncaught ReferenceError: redux is not defined field_button_set.js?ver=1402465855:10
Uncaught ReferenceError: redux is not defined field_gallery.js?ver=1402465855:8

@dovy
Copy link
Contributor Author

dovy commented Jun 11, 2014

Something is off in your files. We don't initialize a $.redux variable now. The redux variable is the localized variable used by all js within Redux.

Sounds like you still have old files. ;)

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

Ok, I'll try again :) but the variable isn't $.redux, it's only "redux" as
in "redux.field_objects".

2014-06-11 9:57 GMT+03:00 Dovy Paukstys notifications@github.com:

Something is off in your files. We don't initialize a $.redux variable
now. The redux variable is the localized variable used by all js within
Redux.

Sounds like you still have old files. ;)


Reply to this email directly or view it on GitHub
#1337 (comment)
.

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

I deleted all the files in the redux admin folder, downloaded the latest ZIP from this repo, unzipped it,
just copied ReduxCore and codestyles folder, index, uninstall, license.txt, class file, reduxframework.php file (they'll be enough I guess), and still getting the same errors on the javascript console.

I'm using dev mode = true (unminified sources).
I modified the barebones config to suit my needs.

@kprovance
Copy link
Member

The redux variable is set by the localize in the core. If you 'view source' on your options panel, somewhere you should see the line var redux = followed by a long json string. If you are not seeing this, then that might be part of the problem. Like Dovy said, make a gist of your config so one of us may try it.

@kprovance
Copy link
Member

FWIW, if I comment out the line wp_enqueue_script( 'redux-js' ); // Enque the JS now in the core, it's reproducible. I have to assume for whatever reason, the resource is not appearing in your panel. Gotta find out why that is.

@ghost
Copy link

ghost commented Jun 11, 2014

I've this problem in my chrome console:

Uncaught ReferenceError: redux is not defined field_switch.js?ver=1402483131:13
Uncaught ReferenceError: redux is not defined field_button_set.js?ver=1402483131:10
Uncaught ReferenceError: redux is not defined field_multi_text.js?ver=1402483131:6
Uncaught ReferenceError: redux is not defined field_slider.js?ver=1402483131:6
Uncaught ReferenceError: redux is not defined field_image_select.js?ver=1402483131:8
Uncaught ReferenceError: redux is not defined field_media.js?ver=1402483131:13
Uncaught ReferenceError: redux is not defined field_editor.js?ver=1402483131:13
Uncaught ReferenceError: redux is not defined field_spinner.js?ver=1402483131:6
Uncaught ReferenceError: redux is not defined field_background.js?ver=1402483131:13
Uncaught ReferenceError: redux is not defined color-picker.js?ver=1402483131:10
Uncaught ReferenceError: redux is not defined field_color_gradient.js?ver=1402483131:10
Uncaught ReferenceError: redux is not defined field_select.js?ver=1402483131:6
Uncaught ReferenceError: redux is not defined field_typography.js?ver=1402483131:15
Uncaught ReferenceError: redux is not defined field_sorter.js?ver=1402483131:12
Uncaught ReferenceError: redux is not defined field_ace_editor.js?ver=1402483131:6
Uncaught ReferenceError: redux is not defined field_import_export.js?ver=1402483131:6
Uncaught TypeError: Cannot read property 'switch' of undefined redux.js?ver=1402482581:429

What appened? Please, fix it fast. It's a BOOM for our code and development.

Thanks.

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

I can see the var redux definition, but it's placed after the field scripts. That might be the problem. On dev mode = true (BTW I didn't test the dev_mode=false), the redux localized data script is loaded after the enqueued field scripts.

@kprovance
Copy link
Member

Interesting, @tpaksu, mine is loaded before the field javascripts. That might be a clue. Wake up, @dovy, join us! ;-)

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

I changed

wp_register_script(
                    'redux-js',
                    self::$_url . 'assets/js/redux' . $min . '.js',
                    $depArray,
                    filemtime( self::$_dir . 'assets/js/redux' . $min . '.js' ),
                    -> true
                );

to false, for letting the script load itself in the head, the problem is gone.

But the question is: is it the proper way to solve this ?

@kprovance
Copy link
Member

Do me a favour, undo that, and on line 422ish, change

add_action( 'admin_enqueue_scripts', array( $this, '_enqueue' ));

to

add_action( 'admin_enqueue_scripts', array( $this, '_enqueue' ), 1 );

I want to see if it makes a difference.

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

nope, still has it.

@kprovance
Copy link
Member

Hmmm, ok. I'd keep what you've done for now. If Dovy gives it his stamp of approval, I'll make it permanent. The change was all about speed improvement. I don't know if putting all that in the head compromises that. Dovy might tho. :)

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

Well, I just read that : registering "redux-js" as a dependency to the field scripts' enqueue lines, is the proper way to solve problems like this. That might change the loading order of "redux-js" in the footer.

@kprovance
Copy link
Member

So, that is to say, go into each field's php, add 'redux-js' to the js enqueue's dependency array, so the var redux stuff loads before the field js? That will cause it to load before the field js?

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

I got curious about it, and found this post and gave me that idea:

http://wordpress.stackexchange.com/a/114502/14452

@kprovance
Copy link
Member

Can you set the enqueue back to true, and add that dep to one of the fields you are using and see if it works? Thing is, mine is still loading before the field js (trying to figure out why). If it works for you, we might have a proper solution :)

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

Yes it worked! The first field loaded and giving error (in my setup) was a media field, I added the "redux-js" dependency to it, and all errors are gone. But we need to apply to all of fields because we won't know which fields will be the first one to load.

wp_enqueue_script(
                    'redux-field-media-js',
                    ReduxFramework::$_url . 'inc/fields/media/field_media' . Redux_Functions::isMin() . '.js',
                    array( 'jquery', 'wp-color-picker', 'redux-js' ),
                    time(),
                    true
                );

@kprovance
Copy link
Member

You sir, get the 'Redux contributor of the day' award!

I concur, especially since the redux builder allows user to pick and choose their fields now, adding the dep to each one is mandatory.

I'll start making changes. Thank you, dude. :D :D :D

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

You're welcome :)

kprovance added a commit that referenced this issue Jun 11, 2014
Signed-off-by:KProvance <kevin.provance@gmail.com>
@kprovance
Copy link
Member

Okay @tpaksu and @gianbalex, I pushed v.3.3.0.6, which adds the redux js dep to every field that requires it. Please let me know if the update works out for each of you. :)

@simrandeep
Copy link

I think performance has improved now. Checking it further.

@tpaksu
Copy link
Contributor

tpaksu commented Jun 11, 2014

Yes, it's working now @kprovance .

@kprovance
Copy link
Member

Awesome. My up at 4 am coz the neighbors dog won't shut up has not been in vain! :) @simrandeep, it's a huge difference. And I run Windows, so to be able to say that is a big deal. ;-)

@edcousins
Copy link

Hi Kevin/Dovy,

Only issue I've found so far is that upon saving theme options, occasionally the Font Weight / Style in typography field will be removed?

Much quicker though, great work!

  • Ed

@kprovance
Copy link
Member

@edcousins, if you want, open a new ticket and include your typography field(s). The new js might be playing havok with it.

@kprovance
Copy link
Member

Fixed, I believe. Closing.

@wpexplorer
Copy link
Contributor

Shit this is fast! I'll get testing, sick!

@kprovance
Copy link
Member

Cha-ching, AJ. ::evil grin::

@maheshwaghmare
Copy link

@kprovance I'm still facing the issue Uncaught ReferenceError: redux is not defined

I'm working on localhost and used plugin Redux Vendor Support to enqueue the local assets.

As @tpaksu suggested ( #1337 (comment) ). I was made changes on locahost i.e.

'dev_mode' => false,

and

File: \framework\core\enqueue.php - Line - 278

// Redux JS
//*****************************************************************
wp_register_script(
                    'redux-js',
                    ReduxFramework::$_url . 'assets/js/redux' . $this->min . '.js',
                    $depArray,
                    $this->timestamp,
                    false
);

Set false in both changes. And it works.

My current redux version is - 3.5.8.1

What was the wrong with my current setup. Or any other issue.

@maheshwaghmare
Copy link

Now, Update it with version 3.5.8.4. Still facing same issue. I'm working on localhost by turning off internet. Its internet issue or any other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants