From 21e67fe9061c4cf389ee3bb6ed588df3d19dd154 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 11:24:56 +0000 Subject: [PATCH 1/3] Initial plan From f9b30e563aebed70bad747cee6c07a0e7834e12f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 11:33:48 +0000 Subject: [PATCH 2/3] fix: avoid startup info modal on password reset routes Agent-Logs-Url: https://github.com/utopia-os/utopia-map/sessions/67d1c62c-2aa3-40ca-a223-5a0b94cc34ac Co-authored-by: antontranelis <31516529+antontranelis@users.noreply.github.com> --- app/src/ModalContent.tsx | 19 +++++++++--- .../authentification/set-new-password.cy.ts | 31 +++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 cypress/e2e/authentification/set-new-password.cy.ts diff --git a/app/src/ModalContent.tsx b/app/src/ModalContent.tsx index 1c3b957f0..e324355a8 100644 --- a/app/src/ModalContent.tsx +++ b/app/src/ModalContent.tsx @@ -5,7 +5,7 @@ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ import { useEffect, useState } from 'react' -import { useNavigate } from 'react-router-dom' +import { useLocation, useNavigate } from 'react-router-dom' import { TextView, useAuth } from 'utopia-ui' import { config } from './config' @@ -95,12 +95,23 @@ const close = () => { } export const ModalContent = ({ map }: { map: any }) => { + const { pathname } = useLocation() + useEffect(() => { - const myModal = document.getElementById('my_modal_3') as HTMLDialogElement - if (map.info_open) { + const myModal = document.getElementById('my_modal_3') as HTMLDialogElement | null + if (!myModal) { + return + } + + if (map.info_open && pathname === '/') { myModal.showModal() + return + } + + if (myModal.open) { + myModal.close() } - }, [map.info_open]) + }, [map.info_open, pathname]) const [chapter, setChapter] = useState(1) // const setQuestsOpen = useSetQuestOpen() diff --git a/cypress/e2e/authentification/set-new-password.cy.ts b/cypress/e2e/authentification/set-new-password.cy.ts new file mode 100644 index 000000000..2d12ae398 --- /dev/null +++ b/cypress/e2e/authentification/set-new-password.cy.ts @@ -0,0 +1,31 @@ +/// + +describe('Utopia Map Set New Password', () => { + beforeEach(() => { + cy.clearCookies() + cy.clearLocalStorage() + cy.window().then((win) => { + win.sessionStorage.clear() + }) + + cy.intercept('GET', '**/items/maps*', (req) => { + req.continue((res) => { + if (Array.isArray(res.body?.data) && res.body.data[0]) { + res.body.data[0].info_open = true + } + }) + }).as('getMap') + + cy.visit('/set-new-password?token=test-reset-token') + cy.wait('@getMap') + }) + + it('should keep the set new password dialog visible when startup info is enabled', () => { + cy.get('h2').should('contain.text', 'Set new Password') + cy.get('input[type="password"]') + .should('be.visible') + .should('have.attr', 'placeholder', 'Password') + + cy.get('dialog#my_modal_3').should('not.have.attr', 'open') + }) +}) From 597c336d2357ba73fdce752cd2c9ef30cd52134d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 11:51:54 +0000 Subject: [PATCH 3/3] test: cover startup modal password reset regression Agent-Logs-Url: https://github.com/utopia-os/utopia-map/sessions/67d1c62c-2aa3-40ca-a223-5a0b94cc34ac Co-authored-by: antontranelis <31516529+antontranelis@users.noreply.github.com> --- app/src/ModalContent.tsx | 15 ++++++++++----- .../e2e/authentification/set-new-password.cy.ts | 14 +++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/src/ModalContent.tsx b/app/src/ModalContent.tsx index e324355a8..0c4fbf5d8 100644 --- a/app/src/ModalContent.tsx +++ b/app/src/ModalContent.tsx @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { useLocation, useNavigate } from 'react-router-dom' import { TextView, useAuth } from 'utopia-ui' @@ -15,6 +15,8 @@ interface ChapterProps { map?: any } +const ROOT_PATH = '/' + export function Welcome1({ clickAction1, map }: ChapterProps) { const { isAuthenticated } = useAuth() const navigate = useNavigate() @@ -96,20 +98,23 @@ const close = () => { export const ModalContent = ({ map }: { map: any }) => { const { pathname } = useLocation() + const autoOpenedModal = useRef(false) useEffect(() => { - const myModal = document.getElementById('my_modal_3') as HTMLDialogElement | null - if (!myModal) { + const myModal = document.getElementById('my_modal_3') + if (!(myModal instanceof HTMLDialogElement)) { return } - if (map.info_open && pathname === '/') { + if (map.info_open && pathname === ROOT_PATH && !myModal.open) { myModal.showModal() + autoOpenedModal.current = true return } - if (myModal.open) { + if (pathname !== ROOT_PATH && autoOpenedModal.current && myModal.open) { myModal.close() + autoOpenedModal.current = false } }, [map.info_open, pathname]) diff --git a/cypress/e2e/authentification/set-new-password.cy.ts b/cypress/e2e/authentification/set-new-password.cy.ts index 2d12ae398..4b0fd7e95 100644 --- a/cypress/e2e/authentification/set-new-password.cy.ts +++ b/cypress/e2e/authentification/set-new-password.cy.ts @@ -1,6 +1,6 @@ /// -describe('Utopia Map Set New Password', () => { +describe('Utopia Map Authentication Set New Password', () => { beforeEach(() => { cy.clearCookies() cy.clearLocalStorage() @@ -15,17 +15,25 @@ describe('Utopia Map Set New Password', () => { } }) }).as('getMap') + }) + it('should keep the set new password dialog visible when startup info is enabled', () => { cy.visit('/set-new-password?token=test-reset-token') cy.wait('@getMap') - }) - it('should keep the set new password dialog visible when startup info is enabled', () => { cy.get('h2').should('contain.text', 'Set new Password') cy.get('input[type="password"]') .should('be.visible') .should('have.attr', 'placeholder', 'Password') + cy.get('button:contains("Set")').should('be.visible').and('not.be.disabled') cy.get('dialog#my_modal_3').should('not.have.attr', 'open') }) + + it('should still open the startup info modal on the root route', () => { + cy.visit('/') + cy.wait('@getMap') + + cy.get('dialog#my_modal_3').should('have.attr', 'open') + }) })