Current section

26 Versions

Jump to

Compare versions

5 files changed
+15 additions
-4 deletions
  @@ -9,6 +9,13 @@ export default class ComponentRegistry {
9 9 ComponentRegistry.entries = Type.map();
10 10 }
11 11
12 + // Optimized (mutates next_action field in-place)
13 + static clearNextAction(cid) {
14 + const entry = ComponentRegistry.entries.data[Type.encodeMapKey(cid)][1];
15 + const componentStruct = entry.data["atom(struct)"][1];
16 + componentStruct.data["atom(next_action)"][1] = Type.nil();
17 + }
18 +
12 19 // null instead of boxed nil is returned by default on purpose, because the function is not used by transpiled code.
13 20 // Deps: [:maps.get/2]
14 21 static getComponentEmittedContext(cid) {
  @@ -64,14 +71,14 @@ export default class ComponentRegistry {
64 71 ComponentRegistry.entries = entries;
65 72 }
66 73
67 - // Optimized (mutates entries/struct field)
74 + // Optimized (mutates entries/struct field in-place)
68 75 static putComponentStruct(cid, componentStruct) {
69 76 ComponentRegistry.entries.data[Type.encodeMapKey(cid)][1].data[
70 77 "atom(struct)"
71 78 ][1] = componentStruct;
72 79 }
73 80
74 - // Optimized (mutates entries field)
81 + // Optimized (mutates entries field in-place)
75 82 static putEntry(cid, entry) {
76 83 ComponentRegistry.entries.data[Type.encodeMapKey(cid)] = [cid, entry];
77 84 }
  @@ -283,6 +283,8 @@ export default class Hologram {
283 283 );
284 284
285 285 if (!Type.isNil(nextAction)) {
286 + ComponentRegistry.clearNextAction(cid);
287 +
286 288 let actionWithTarget = nextAction;
287 289
288 290 if (
  @@ -477,6 +477,8 @@ export default class Renderer {
477 477 );
478 478
479 479 if (!Type.isNil(nextAction)) {
480 + ComponentRegistry.clearNextAction(cid);
481 +
480 482 let actionWithTarget = nextAction;
481 483
482 484 const existingTarget = Erlang_Maps["get/3"](
  @@ -8,7 +8,7 @@
8 8 {<<"Sponsor">>,<<"https://github.com/sponsors/bartblast">>},
9 9 {<<"Website">>,<<"https://hologram.page">>}]}.
10 10 {<<"name">>,<<"hologram">>}.
11 - {<<"version">>,<<"0.8.0">>}.
11 + {<<"version">>,<<"0.8.1">>}.
12 12 {<<"description">>,
13 13 <<"Full stack isomorphic Elixir web framework that can be used on top of Phoenix.">>}.
14 14 {<<"elixir">>,<<"~> 1.0">>}.
  @@ -2,7 +2,7 @@
2 2 defmodule Hologram.MixProject do
3 3 use Mix.Project
4 4
5 - @version "0.8.0"
5 + @version "0.8.1"
6 6
7 7 # Copied from Hologram.Commons.SystemUtils
8 8 @windows_exec_suffixes [".bat", ".cmd", ".exe"]