overthesun / simoc-web

This is the web interface to SIMOC
https://ngs.simoc.space/
Other
3 stars 0 forks source link

Bump pinia from 2.2.4 to 2.2.6 #844

Closed dependabot[bot] closed 2 hours ago

dependabot[bot] commented 3 weeks ago

Bumps pinia from 2.2.4 to 2.2.6.

Release notes

Sourced from pinia's releases.

pinia@2.2.6

Please refer to CHANGELOG.md for details.

pinia@2.2.5

Please refer to CHANGELOG.md for details.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
ezio-melotti commented 1 week ago

@dependabot rebase

ezio-melotti commented 3 days ago

This seems to be caused by:

The behavior changed in 2.2.5 and apparently Pinia is now trying to evaluate https://github.com/overthesun/simoc-web/blob/000955494c20c10b55bf685cde99c2e04ea1a5ba/src/store/modules/WizardStore.js#L345-L348 as soon as the app is started and the wizard store imported, resulting in an error because store.configuration is not yet set to an actual configuration object.

I tried to fix the problem by returning early if store.configuration is not initialized:

diff --git a/src/store/modules/WizardStore.js b/src/store/modules/WizardStore.js
index 0469ea0..1f8adab 100644
--- a/src/store/modules/WizardStore.js
+++ b/src/store/modules/WizardStore.js
@@ -344,6 +344,9 @@ export const useWizardStore = defineStore('WizardStore', {

         getTotalMissionHours(state) {
             let totalHours = 0
+            if (Object.keys(state.configuration).length === 0) {
+                return totalHours  // the config is not initialized yet, return 0
+            }
             const durationLength = state.configuration.duration.amount
             const durationUnits = state.configuration.duration.units

@@ -361,6 +364,9 @@ export const useWizardStore = defineStore('WizardStore', {
         // Returns a formatted configuration object in the format required by the backend.
         getFormattedConfiguration(state) {
             const config = state.configuration
+            if (Object.keys(config).length === 0) {
+                return {}  // the config is not initialized yet, return {}
+            }
             // create formatted configuration
             const fconfig = {
                 location: config.location,

This seems to solve the issue for the time being (after I applied a similar fix to getFormattedConfiguration too), however there might be better solutions. I'll wait to apply it in case the issue gets fixed upstream.

dependabot[bot] commented 2 hours ago

Superseded by #877.