Skip to content

Dynamic components #89

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

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Dynamic components #89

merged 1 commit into from
Feb 5, 2024

Conversation

lifeart
Copy link
Owner

@lifeart lifeart commented Feb 5, 2024

In general, we should work here like in if, but check component class by reference.

Like:

const tag = formula(() => componentReference());
let oldValue = null;
let oldComponent = null;
opcodeFor(tag, (value) => {
   if (oldValue !== value) {
      oldValue = value;
   }
   destroyComponent(oldComponent);
   oldComponent = renderComponent(value, target); 
});

To optimize perf we may use weakMap for componentReference to check if we need to resolve dynamic vars or not..

Copy link

netlify bot commented Feb 5, 2024

Deploy Preview for g-next ready!

Name Link
🔨 Latest commit ac43654
🔍 Latest deploy log https://app.netlify.com/sites/g-next/deploys/65c11d4aa1fbf20008e2b55d
😎 Deploy Preview https://deploy-preview-89--g-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lifeart lifeart changed the title [WIP] Dynamic components Dynamic components Feb 5, 2024
@lifeart lifeart force-pushed the dynamic-components branch from e282eb5 to ac43654 Compare February 5, 2024 17:39
Copy link

github-actions bot commented Feb 5, 2024

Code Coverage Report

Coverage after merging dynamic-components into master

76.01%
Coverage Report
FileLines (%)Funcs (%)Uncovered Lines
.../pages/page-one
   Smile.ts77.556, 7, 8, 9, ...
.../pages/page-two
   Clock.ts94.1283.3317, 26
tests
   utils.ts95.5629, 73, 74, 75, ...
utils
   benchmark.ts69.4419, 20, 21, 22, ...
   compat.ts96.2328, 29, 30, 38, ...
   component.ts95.6079, 8, 9, 97, ...
   dom-api.ts95.6512, 21, 22, 23, ...
   dom.ts98.4290843, 851, 852, 922, ...
   ember-inspector.ts14.70096, 97, 98, 99, ...
   if.ts65.1266.6788, 89, 98, 99, ...
   list.ts93.448066, 70, 71, 72, ...
   reactive.ts91.2956, 61, 66, 67, ...
   rehydration-dom-api.ts48.4196, 97, 98, 99, ...
   rehydration.ts135, 144, 34, 37, ...
   runtime.ts95.7411, 12, 13
   shared.ts76.7095, 96, 97, 98, ...
   vm.ts24, 4
utils/helpers
   hash.ts81.8266.6714, 15, 16, 17, ...
   if.ts66.672, 3, 4
utils/inspector
   index.ts33.33096, 97, 98, 99, ...

@lifeart lifeart marked this pull request as ready for review February 5, 2024 17:42
@lifeart lifeart mentioned this pull request Feb 5, 2024
82 tasks
Copy link

github-actions bot commented Feb 5, 2024

duration phase no difference [-187ms to 92ms]
renderEnd phase no difference [0ms to 1ms]
render1000Items1End phase no difference [-15ms to 3ms]
clearItems1End phase no difference [-4ms to 2ms]
render1000Items2End phase no difference [-16ms to 0ms]
clearItems2End phase no difference [-1ms to 0ms]
render5000Items1End phase no difference [-34ms to 23ms]
clearManyItems1End phase no difference [-1ms to 3ms]
render5000Items2End phase no difference [-34ms to 17ms]
clearManyItems2End phase no difference [-2ms to 4ms]
render1000Items3End phase no difference [-13ms to 22ms]
append1000Items1End phase no difference [-17ms to 17ms]
append1000Items2End phase no difference [-36ms to 12ms]
updateEvery10thItem1End phase no difference [-1ms to 1ms]
updateEvery10thItem2End phase no difference [-17ms to 10ms]
selectFirstRow1End phase no difference [-3ms to 2ms]
selectSecondRow1End phase no difference [0ms to 0ms]
removeFirstRow1End phase no difference [0ms to 0ms]
removeSecondRow1End phase no difference [0ms to 0ms]
swapRows1End phase no difference [-14ms to 1ms]
swapRows2End phase no difference [-1ms to 0ms]
clearItems4End phase no difference [-3ms to 4ms]
paint phase no difference [0ms to 0ms]

[18:27:55] Generating Benchmark Reports [started]
[18:28:00] Generating Benchmark Reports [completed]

Benchmark Reports    

JSON: /home/runner/work/glimmer-next/glimmer-next/tracerbench-results/compare.json

PDF: /home/runner/work/glimmer-next/glimmer-next/tracerbench-results/artifact-1.pdf

HTML: /home/runner/work/glimmer-next/glimmer-next/tracerbench-results/artifact-1.html

@lifeart lifeart merged commit 5f7702a into master Feb 5, 2024
@lifeart lifeart deleted the dynamic-components branch February 5, 2024 18:29
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

Successfully merging this pull request may close these issues.

1 participant