Starcounter / HelloWorld

Sample Starcounter application that shows CRUD operations with Palindrom (HTML+JSON-Patch client)
0 stars 7 forks source link

Create a HelloWorld fork with Polymer 2.0 #45

Closed warpech closed 6 years ago

warpech commented 7 years ago

Let's try to use HelloWorld as a playground to investigate bridging PuppetJs with Polymer 2.0 (instead of 1.x).

@alshakero please take this and see how far we can get.

warpech commented 7 years ago

cc @tomalec

warpech commented 7 years ago

@tomalec is also trying to attack upgrade to Web Components v1 and Polymer 2.0 from another, low level end. Let's see how far you can get coming from PuppetJs end and then we will be able to compare resutls.

I think that this will be easier with Step 4, because it only uses <template is="imported-template"> (which is Polymer), not <starcounter-include> (which is vanilla).

tomalec commented 7 years ago

<template is="imported-template"> (which is Polymer), not <starcounter-include> (which is vanilla).

imported-template is vanilla as well

https://github.com/Juicy/imported-template/blob/master/imported-template.html

Anyway I believe it would be way much easier if you will not have to bother about blending, and could control binding by yourself, or wrap it with <dom-bind>.

alshakero commented 7 years ago

Hello, I created Polymer 2.0 branch for HelloWorld without blending, I guess it's the simplest example. Do you think I should create another component as a substitute of puppet-client as a next step?

I don't know if it is my fault being no Polymer expert, or it's actually Polymer's 2 fault. But for some reason the {{model.variable}} binding is one step late. And when I console.log the object, Palindrom is actually updating it, but Polymer isn't showing the up-to-date state.

(https://github.com/StarcounterSamples/HelloWorld/blob/polymer-2/src/HelloWorld/Program.cs#L59)

Would appreciate some help.

tomalec commented 7 years ago

It's hard to see the diff as there is just palindrom.min.js, also it does not use imported-template (PersonJson.html) at all, everything is just pushed to PartialToStandaloneHtmlProvider

alshakero commented 7 years ago

That's true. It's intentionally over simplified. Because this is the first time we see:

1) JSON-Patch (the proxies version) actually working. 2) Palindrom actually working. 3) Me actually working with Polymer.

So I didn't want to trap myself with many issues at once. You can consider this sample as a bug reproduction code.

The bug being {{model.FullName}} isn't equal to model.FullName.

tomalec commented 7 years ago

Well.. It's not the first time I see Palindrom/Puppet actually working ;)

And the changes made to Puppet + JSON Patch stack are very important to review

alshakero commented 7 years ago

I completely agree. Do you suggest something I could do to understand why {{model.FullName}} isn't working?

tomalec commented 7 years ago

Well, I believe it means integration w/ Polymer does not work smoothly, I'd debug Polymer code, most probably you need to notify Polymer's binding system about the change, as we did in puppet-polymer-client https://github.com/PuppetJs/puppet-polymer-client/blob/master/puppet-client.html#L421

warpech commented 7 years ago

@alshakero please continue with that. After working Step 4 we will need working Step 6 (and eventually Step 9), which requires communication between instances of <dom-bind>. I guess it is only solvable when you manage to solve the 2-way binding problem.

Polymer 2.0 is by no means finished, so it is expected that we will find problems that need asking on Polymer issue board, or changes to Polymer that we need to propose (as an issue and/or PR).

warpech commented 7 years ago

The final solution needs to be with zero code regarding Polymer 2.0 between lines: https://github.com/StarcounterSamples/HelloWorld/blob/polymer-2/src/HelloWorld/Program.cs#L31-L105. Polymer 2.0 must be bootstraped in PersonJson.html

alshakero commented 7 years ago

I need some more help. I ported puppet-client to Polymer 2.0 and it looks super cool, the difference is minimal.

And I used customElements.define() to define it. Then I noticed that imported-template isn't working, and isn't fetching the template, and _loadExternalFile isn't being called at all.

Is it OK to use the deprecated document.registerElement with WC 1.0? I can't find any other reason imported-template wouldn't work. Does it make sense to use customElements.define and document.registerElement side-by-side?

atifwaqar commented 7 years ago

Just the thing I was looking for :) So when is Polymer 2.0 going to be supported in SC?

warpech commented 7 years ago

We are looking to be ready in September 2017, with some proof of concept probably being available earlier.

There will be effort in migrating all of the apps (views and custom elements) from Polymer 1.x to 2.0.

Mackiovello commented 7 years ago

@alshakero where are we on this? Can it be closed?

atifwaqar commented 7 years ago

@Mackiovello I have a project that I can test. but to my understanding, SC 2.4 supports Polymer 2.0. And I can not test/use 2.4 cuz other SC apps (People, Signin, Useradmin) do not work on SC 2.4.

I can start testing 2.4 when you guys give me a green signal about SC 2.4 being ready to run People, Signin, Useradmin.

alshakero commented 7 years ago

@Mackiovello I guess we can close this in favour of a fresh issue when the time comes to migrate HelloWorld.

Mackiovello commented 7 years ago

Thank you for both your answers. Yes, 2.4 will eventually support Polymer 2.0.

I guess we can close this in favour of a fresh issue when the time comes to migrate HelloWorld.

Yes, what I would suggest is that when 2.3.1 becomes the next release and 2.4 becomes the release candidate, we update this app to work with 2.4. Until then, we'll wait. I'll assign myself to deal with it.

Mackiovello commented 6 years ago

We've migrated to Polymer 2 as I understand it, so I don't think this issue is important anymore. Closing as won't fix