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

Replace prototype-light.js #3106

Merged
merged 8 commits into from
Jul 25, 2018
Merged

Replace prototype-light.js #3106

merged 8 commits into from
Jul 25, 2018

Conversation

kirjavascript
Copy link
Contributor

Changes in this pull request

Resolves #2974

Additional info

Work in progress - additional bugfixes to follow

See the previous PR for more information

@brusch brusch changed the title Replace prototype-light.js [WIP] Replace prototype-light.js Jul 19, 2018
@brusch
Copy link
Member

brusch commented Jul 19, 2018

Let's continue the discussion here.
So there seems to be an issue with the scopes:

TypeError: Cannot read property 'bind' of undefined
    at Function.getLayout (properties.js?_dc=285:64)
    at Function.<anonymous> (class.js?_dc=285:67)
    at Function.getLayout (properties.js?_dc=285:38)
    at klass.getLayout (class.js?_dc=285:22)
    at klass.getTabPanel (page.js?_dc=285:72)
    at klass.addTab (page_snippet.js?_dc=285:35)
    at klass.getDataComplete (document.js?_dc=285:44)
    at Object.callback (ext-all-debug.js?_dc=285:8174)
    at constructor.onComplete (ext-all-debug.js?_dc=285:24674)
    at constructor.onStateChange (ext-all-debug.js?_dc=285:24631)

@kirjavascript
Copy link
Contributor Author

Having trouble reproducing that, how did you trigger the error?

@dpfaffenbauer
Copy link
Contributor

Just for reference: Object.extend is important cause of BC. Plugins may use that function and removing it will cause issues.

@kirjavascript
Copy link
Contributor Author

@dpfaffenbauer is a solution for that simply providing an optional backwards compat shim?

(It would literally just be a small variation on the previous prototype-light.js file)

@dpfaffenbauer
Copy link
Contributor

@kirjavascript well, but Pimcore needs to require that shim, just providing it doesn't help, it would still be a BC break.

@kirjavascript
Copy link
Contributor Author

kirjavascript commented Jul 19, 2018

@dpfaffenbauer in that case requiring the shim would have the same effect as not removing prototype-light at all

I'm not sure it's possible to complete this task without breaking BC for plugins then :/

@brusch
Copy link
Member

brusch commented Jul 19, 2018

I think first of all we should get it working, then we can discuss about the BC :-)

@kirjavascript the error occurs when opening a document page

@brusch
Copy link
Member

brusch commented Jul 19, 2018

@kirjavascript are you able to reproduce it?

@kirjavascript
Copy link
Contributor Author

kirjavascript commented Jul 20, 2018

@brusch yeah, I don't know why it wasn't breaking before - it's actually easy to reproduce

in the conversion process I seemingly lost the context at some point in the addMethods function - should be fixed now

@brusch brusch self-assigned this Jul 23, 2018
@brusch brusch added this to the 5.4.0 milestone Jul 23, 2018
@brusch brusch added the Task label Jul 23, 2018
@brusch
Copy link
Member

brusch commented Jul 23, 2018

@kirjavascript Did a lot of testing and it seems it's all done now. Good job!

@brusch
Copy link
Member

brusch commented Jul 23, 2018

added upgrade notes regarding BC breaks

- `Object.toQueryString()` ( `Ext.Object.toQueryString` )
- `Object.clone()` ( `Object.assign({}, object)` )
- `Object.toHTML()`
- `Object.is[Element|Array|Hash|Function|String|Number|Undefined]()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacement could partly come from ExtJS.

Ext.isArray, Ext.isFunction, Ext.isString, Ext.isDefined and so on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint, added them in detail

@dpfaffenbauer
Copy link
Contributor

I still don't like the BC break, but it is not too bad and it is documented. So there is nothing more to add from my side.

@brusch
Copy link
Member

brusch commented Jul 23, 2018

@kirjavascript can you try to resolve the conflicts? Thanks!

@kirjavascript
Copy link
Contributor Author

Conflicts resolved.

Added alternatives for Array methods into the docs.

As for the Function prototype methods I'm not able to recreate some of the things in a concise way, so if alternatives cannot be found in Ext we could possibly point to another library that contains them?

This might not be important though, since I imagine these methods are rarely if ever used

@brusch brusch changed the base branch from master to v5.4.0-dev July 24, 2018 15:07
@brusch
Copy link
Member

brusch commented Jul 24, 2018

@kirjavascript I've changed the base of this PR to the pimcore:v5.4.0-dev branch, so we can merge it. Unfortunately your fork is outdated and doesn't have the v5.4.0-dev branch, so I'm unable to resolve the conflicts, can you help me out once again?

Thank you very much!

@kirjavascript
Copy link
Contributor Author

@brusch added v5.4.0-dev to my fork - do I need to merge from v5.4.0-dev to replace_prototype-light.js too?

@brusch
Copy link
Member

brusch commented Jul 24, 2018

Yep, I think thats necessary to resolve the conflicts.

# Conflicts:
#	pimcore/lib/Pimcore/Bundle/AdminBundle/Resources/views/Admin/Index/index.html.php
#	pimcore/lib/Pimcore/Bundle/CoreBundle/EventListener/Frontend/EditmodeListener.php
#	web/pimcore/static6/js/pimcore/layout/portlets/customreports.js
#	web/pimcore/static6/js/pimcore/startup.js
@brusch
Copy link
Member

brusch commented Jul 25, 2018

@kirjavascript Thanks, I was now able to merge it - so nothing else to do for you.

@brusch brusch changed the title [WIP] Replace prototype-light.js Replace prototype-light.js Jul 25, 2018
@brusch brusch merged commit e8514a1 into pimcore:v5.4.0-dev Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants