From 7b928e388c9a589805bf393c6d92926cc94865d1 Mon Sep 17 00:00:00 2001
From: MapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com>
Date: Tue, 21 Dec 2021 10:17:21 -0600
Subject: [PATCH] fix missed update issue
---
src/reconciler.ts | 9 +++++++--
src/rendering.test.tsx | 4 ++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/reconciler.ts b/src/reconciler.ts
index 6ca659c..fc68e56 100644
--- a/src/reconciler.ts
+++ b/src/reconciler.ts
@@ -39,7 +39,7 @@ export const reconciler = ReactReconciler<
never, // HydratableInstance,
never, // PublicInstance,
null, // HostContext,
- never, // UpdatePayload,
+ [], // UpdatePayload,
BaseInstance[], // ChildSet,
unknown, // TimeoutHandle,
unknown // NoTimeout
@@ -100,10 +100,15 @@ export const reconciler = ReactReconciler<
newProps: Props,
) => createInstance(type, newProps),
+ // returning a non-null value tells react to re-render the whole thing
+ // on any prop change
+ //
+ // we can probably optimize this to actually compare old/new props though
+ prepareUpdate: () => [],
+
finalizeInitialChildren: () => false,
prepareForCommit: (container) => null,
resetAfterCommit: () => null,
- prepareUpdate: () => null,
getPublicInstance: () => raise("Not implemented"),
preparePortalMount: () => raise("Not implemented"),
})
diff --git a/src/rendering.test.tsx b/src/rendering.test.tsx
index 4beb16b..5e2f7d3 100644
--- a/src/rendering.test.tsx
+++ b/src/rendering.test.tsx
@@ -60,12 +60,12 @@ test("nested text", async () => {
await assertMessages([{ content: "hi world hi moon hi sun" }])
})
-test.only("empty embed fallback", async () => {
+test("empty embed fallback", async () => {
await root.render()
await assertMessages([{ embeds: [{ description: "_ _" }] }])
})
-test.only("embed with only author", async () => {
+test("embed with only author", async () => {
await root.render()
await assertMessages([
{ embeds: [{ description: "_ _", author: { name: "only author" } }] },