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

NodeRED Restart Required When Changing Name or App Icon #1451

Open
cgjgh opened this issue Nov 7, 2024 · 2 comments
Open

NodeRED Restart Required When Changing Name or App Icon #1451

cgjgh opened this issue Nov 7, 2024 · 2 comments
Labels
bug Something isn't working size:S - 2 Sizing estimation point

Comments

@cgjgh
Copy link
Contributor

cgjgh commented Nov 7, 2024

Current Behavior

NodeRED needs to be restarted for name or app icon changes to take effect, seemingly due to the following:
init function gets executed on every deploy but anything inside if (!uiShared.app) {} only on initial Dashboard start.

function init(node, config) {
    node.uiShared = uiShared

    // ...

    if (!uiShared.app) {
        // ...
        uiShared.app.get('/dashboard/manifest.webmanifest', (req, res) => {
            const hasAppIcon = (config.appIcon && config.appIcon.trim() !== '')
            const manifest = {
                name: config.name,
                short_name: config.name,
                start_url: './',
                display: 'standalone',
                background_color: '#ffffff',
                lang: 'en',
                scope: './',
                description: config.name,
                theme_color: '#ffffff',
                icons: [
                    { src: hasAppIcon ? config.appIcon : 'pwa-64x64.png', sizes: '64x64', type: 'image/png' },
                    { src: hasAppIcon ? config.appIcon : 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
                    { src: hasAppIcon ? config.appIcon : 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
                    { src: hasAppIcon ? config.appIcon : 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }
                ]
            }
            return res.json(manifest)
        })
    }
    // ...
}

Expected Behavior

Name and app icon should be updated after deploying - possible workaround to avoid expensive full reinitializations on every deploy would be to add a manual reload button in ui-base settings.

Steps To Reproduce

  1. Deploy flow with D2.
  2. Observe app name or icon when pressing Install (PWA).
  3. Change app name or icon in ui-config settings and deploy.
  4. Reload page (several times for good measure) and observe app name or icon when pressing Install (PWA). Changes do not update.
  5. After a NodeRED restart the above procedure will result in correctly updated changes.

Environment

  • Dashboard version: 1.19.1
  • Node-RED version: 4.0.2
  • Node.js version:
  • npm version:
  • Platform/OS: Any
  • Browser: Any

Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

@cgjgh cgjgh added bug Something isn't working needs-triage Needs looking at to decide what to do labels Nov 7, 2024
@joepavitt joepavitt added size:S - 2 Sizing estimation point and removed needs-triage Needs looking at to decide what to do labels Nov 8, 2024
@joepavitt joepavitt moved this from Backlog to Up Next in Dashboard Backlog Nov 8, 2024
@joepavitt
Copy link
Collaborator

Goods spot, I'm not sure why that would have been gated in the original commit. @Steve-Mcl can you think of any reasons I'm missing here?

@Steve-Mcl
Copy link
Contributor

I was aware this was required (I mentioned it at the time of implementation) I was told it was the only way currently possible without restructuring. I agree it is not ideal but i don't know without investigation what the refactoring would involve - sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:S - 2 Sizing estimation point
Projects
Status: Up Next
Development

No branches or pull requests

3 participants