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

Clear hash in updateAppMetadata will result in refresh #163

Closed
thekingofcity opened this issue Jan 20, 2025 · 1 comment · Fixed by #164
Closed

Clear hash in updateAppMetadata will result in refresh #163

thekingofcity opened this issue Jan 20, 2025 · 1 comment · Fixed by #164
Labels
bug Something isn't working

Comments

@thekingofcity
Copy link
Member

thekingofcity commented Jan 20, 2025

diff --git a/runtime-demo/src/components/metadata-demo.tsx b/runtime-demo/src/components/metadata-demo.tsx
index c9f9f7d..c76d03f 100644
--- a/runtime-demo/src/components/metadata-demo.tsx
+++ b/runtime-demo/src/components/metadata-demo.tsx
@@ -35,6 +35,10 @@ export default function MetadataDemo() {
         rmgRuntime.updateAppMetadata({ hash: `/${incrementAndGet()}` });
     };
 
+    const handleResetHash = () => {
+        rmgRuntime.updateAppMetadata({ hash: '' });
+    };
+
     return (
         <RmgSection>
             <RmgSectionHeader>
@@ -53,6 +57,9 @@ export default function MetadataDemo() {
                 <Button size="sm" onClick={handleUpdateHash}>
                     Update hash
                 </Button>
+                <Button size="sm" onClick={handleResetHash}>
+                    Reset hash
+                </Button>
             </HStack>
         </RmgSection>
     );
@thekingofcity thekingofcity added the bug Something isn't working label Jan 20, 2025
wongchito added a commit that referenced this issue Jan 20, 2025
@wongchito wongchito mentioned this issue Jan 20, 2025
@wongchito
Copy link
Member

When updating query parameters or removing the hash (including the #) from the URL src of an iframe element, the iframe will be reloaded.

Rather than updating the iframe src attribute immediately after receiving updateAppMetadata, we instead store the updated metadata in localStorage, which will be used in RMT next load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants