@paris-ias/list 1.0.178 → 1.0.179

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paris-ias/list",
3
3
  "configKey": "list",
4
- "version": "1.0.178",
4
+ "version": "1.0.179",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -206,7 +206,6 @@
206
206
  eager
207
207
  ripple
208
208
  variant="accordion"
209
- "
210
209
  >
211
210
  <v-expansion-panel
212
211
  v-if="item.description"
@@ -42,10 +42,10 @@ const props = defineProps({
42
42
  },
43
43
  })
44
44
  const visible = computed(() => {
45
- console.log(
45
+ /* console.log(
46
46
  "SHOULD DISPLAY FILTERS:",
47
47
  $stores[props.type]?.filtersCount && $stores[props.type]?.filtersCount > 0,
48
- )
48
+ ) */
49
49
  return !!(
50
50
  $stores[props.type]?.filtersCount && $stores[props.type]?.filtersCount > 0
51
51
  )
@@ -105,7 +105,7 @@ const props = defineProps({
105
105
  })
106
106
 
107
107
  // Initialize loading state
108
- console.log("start llocal loading from setup")
108
+ /* console.log("start llocal loading from setup") */
109
109
  rootStore.setLoading(true, props.type)
110
110
 
111
111
  // Initial route -> store (single source-of-truth on first load)
@@ -132,8 +132,8 @@ const itemTemplate = computed(() =>
132
132
  ).toString(),
133
133
  ),
134
134
  )
135
- console.log("Starting query for type: ", props.type)
136
- console.log("Using variables: ", variables.value)
135
+ /* console.log("Starting query for type: ", props.type)
136
+ console.log("Using variables: ", variables.value) */
137
137
 
138
138
  // Apollo GraphQL query with proper reactivity
139
139
  const { data, pending, error, refresh } = await useAsyncQuery(
@@ -152,20 +152,32 @@ if (error.value) {
152
152
 
153
153
  // Apply data to store immediately if available
154
154
  if (data.value) {
155
- console.log("Applying data to store directly [first load scenario]")
155
+ /* console.log("Applying data to store directly [first load scenario]") */
156
156
  rootStore.applyListResult(props.type, data.value)
157
157
  }
158
158
 
159
+ // Watch for route query changes to update filters
160
+ watch(
161
+ () => route.query,
162
+ (newQuery, oldQuery) => {
163
+ if (JSON.stringify(newQuery) !== JSON.stringify(oldQuery)) {
164
+ /* console.log("Route query changed, reloading filters from URL") */
165
+ rootStore.loadRouteQuery(props.type)
166
+ }
167
+ },
168
+ { deep: true },
169
+ )
170
+
159
171
  // Watch for variable changes to refresh and apply new data
160
172
  watch(
161
173
  variables,
162
174
  async (newVars, oldVars) => {
163
175
  if (newVars && JSON.stringify(newVars) !== JSON.stringify(oldVars)) {
164
- console.log("Variables changed, refreshing query, newVars: ", newVars)
176
+ /* console.log("Variables changed, refreshing query, newVars: ", newVars) */
165
177
  rootStore.setLoading(true, props.type)
166
178
  await refresh()
167
179
  if (data.value) {
168
- console.log("Applying refreshed data to store")
180
+ /* console.log("Applying refreshed data to store") */
169
181
  rootStore.applyListResult(props.type, data.value)
170
182
  }
171
183
  rootStore.setLoading(false, props.type)
@@ -179,7 +191,7 @@ const items = computed(() => $stores[props.type]?.items || [])
179
191
 
180
192
  onMounted(() => {
181
193
  // On initial mount: clear loading state
182
- console.log("STOP local loading from mounted")
194
+ /* console.log("STOP local loading from mounted") */
183
195
  rootStore.setLoading(false, props.type)
184
196
  })
185
197
 
@@ -187,7 +199,7 @@ onBeforeUnmount(() => {
187
199
  rootStore.resetState(props.type, locale.value)
188
200
  })
189
201
  async function onPageChange(newPage) {
190
- console.log("onPageChange: ", newPage)
202
+ /* console.log("onPageChange: ", newPage) */
191
203
 
192
204
  // Set loading state first
193
205
  rootStore.setLoading(true, props.type)
@@ -26,7 +26,6 @@ export const useRootStore = defineStore("rootStore", {
26
26
  }),
27
27
  actions: {
28
28
  setLoading(value, type = "") {
29
- console.log("X - setLoading", { value, type });
30
29
  const { $stores } = useNuxtApp();
31
30
  if (type.length && $stores[type]) {
32
31
  $stores[type].loading = value;
@@ -40,7 +39,6 @@ export const useRootStore = defineStore("rootStore", {
40
39
  }
41
40
  },
42
41
  loadRouteQuery(type) {
43
- console.log("0 - loadRouteQuery", type);
44
42
  const { currentRoute } = useRouter();
45
43
  const { $stores } = useNuxtApp();
46
44
  const query = currentRoute.value.query;
@@ -60,7 +58,6 @@ export const useRootStore = defineStore("rootStore", {
60
58
  $stores[type].page = parseInt(query.page, 10) || 1;
61
59
  },
62
60
  setFiltersCount(type) {
63
- console.log("6- setFiltersCount", type);
64
61
  const { $stores } = useNuxtApp();
65
62
  const filters = $stores[type]?.filters ?? {};
66
63
  const count = Object.values(filters).reduce((acc, filter) => {
@@ -71,7 +68,6 @@ export const useRootStore = defineStore("rootStore", {
71
68
  $stores[type].filtersCount = count;
72
69
  },
73
70
  updateRouteQuery(type) {
74
- console.log("5- updateRouteQuery", type);
75
71
  const router = useRouter();
76
72
  const { $stores } = useNuxtApp();
77
73
  const routeQuery = {
@@ -93,7 +89,6 @@ export const useRootStore = defineStore("rootStore", {
93
89
  router.replace({ query: routeQuery });
94
90
  },
95
91
  resetState(type, lang = "en") {
96
- console.log("Y - resetState", { type, lang });
97
92
  const { $stores, $models } = useNuxtApp();
98
93
  const model = structuredClone($models[type]);
99
94
  $stores[type].filters = model?.filters;
@@ -102,10 +97,6 @@ export const useRootStore = defineStore("rootStore", {
102
97
  $stores[type].sortKey = null;
103
98
  },
104
99
  updateSort({ type, sortKey }) {
105
- console.log("Z - updateSort", {
106
- type,
107
- sortKey
108
- });
109
100
  const { $stores } = useNuxtApp();
110
101
  $stores[type].page = 1;
111
102
  $stores[type].sortKey = sortKey;
@@ -116,7 +107,6 @@ export const useRootStore = defineStore("rootStore", {
116
107
  type,
117
108
  lang
118
109
  }) {
119
- console.log("W - updateView", { value, type });
120
110
  const { $stores } = useNuxtApp();
121
111
  if ($stores[type]?.views?.[value]) {
122
112
  $stores[type].view = {
@@ -132,7 +122,6 @@ export const useRootStore = defineStore("rootStore", {
132
122
  }, */
133
123
  updateFilter(key, val, type, lang) {
134
124
  const { $stores } = useNuxtApp();
135
- console.log("R - update filter: ", { key, val, type });
136
125
  if ($stores[type]?.filters?.[key]) {
137
126
  $stores[type].filters[key].value = val;
138
127
  }
@@ -146,7 +135,6 @@ export const useRootStore = defineStore("rootStore", {
146
135
  type,
147
136
  lang
148
137
  }) {
149
- console.log("H - updateItemsPerPage", { value, type });
150
138
  const { $stores } = useNuxtApp();
151
139
  this.page = 1;
152
140
  $stores[type].itemsPerPage = value;
@@ -158,7 +146,6 @@ export const useRootStore = defineStore("rootStore", {
158
146
  type,
159
147
  lang = "en"
160
148
  }) {
161
- console.log("update page: ", page);
162
149
  const router = useRouter();
163
150
  const currentQuery = router.currentRoute.value.query;
164
151
  const newQuery = { ...currentQuery };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "license": "AGPL-3.0-only",
3
3
  "main": "./dist/module.mjs",
4
- "version": "1.0.178",
4
+ "version": "1.0.179",
5
5
  "name": "@paris-ias/list",
6
6
  "repository": {
7
7
  "url": "git+https://github.com/IEA-Paris/list.git",
8
8
  "type": "git"
9
9
  },
10
10
  "dependencies": {
11
- "@paris-ias/trees": "^2.0.45"
11
+ "@paris-ias/trees": "^2.0.47"
12
12
  },
13
13
  "description": "Paris IAS List Module",
14
14
  "peerDependencies": {