pawajs-continue 1.0.9 → 1.0.11

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.
Files changed (3) hide show
  1. package/component.js +9 -1
  2. package/index.js +10 -5
  3. package/package.json +2 -2
package/component.js CHANGED
@@ -174,6 +174,8 @@ const oldState=getCurrentContext()
174
174
  childInsert()
175
175
  lifeCircle()
176
176
  storeContext._hasRun=true
177
+ }).finally(()=>{
178
+ el._clearContext()
177
179
  })
178
180
  }else{
179
181
  Object.assign(element._context,stateContexts._insert)
@@ -184,6 +186,7 @@ const oldState=getCurrentContext()
184
186
  Object.assign(element._context,component._insert)
185
187
  // console.log(el,el._context)
186
188
  }
189
+ const context=element._context
187
190
  const childInsert=()=>{
188
191
  // if (getCorrectContext(component._insert)) { // check if the component context doesn't match with the servers
189
192
  // return
@@ -209,7 +212,11 @@ const oldState=getCurrentContext()
209
212
  if (number.notRender !== null && isIndex <= number.notRender){
210
213
  return
211
214
  }
212
- render(value,element._context,number,attr.name)
215
+ const getId=value.getAttribute('by')
216
+ if (id !== getId) {
217
+ return
218
+ }
219
+ render(value,context,number,attr.name)
213
220
  })
214
221
  }
215
222
  if(!isAwait){
@@ -254,6 +261,7 @@ const oldState=getCurrentContext()
254
261
  }
255
262
  if(!isAwait){
256
263
  lifeCircle()
264
+ element._clearContext()
257
265
  }
258
266
  stateContexts._hasRun=true
259
267
 
package/index.js CHANGED
@@ -20,16 +20,17 @@ export const resume_text=(el,attr,isName)=>{
20
20
  value.remove()
21
21
  }
22
22
  })
23
+ const context=el._context
23
24
  const evaluate = () => {
24
25
  try {
25
26
  // Always use original content from map for evaluation
26
27
  let value = textNodes
27
28
  const regex = /@{([^}]*)}/g;
28
- const keys = Object.keys(el._context);
29
+ const keys = Object.keys(context);
29
30
  const resolvePath = (path, obj) => {
30
31
  return path.split('.').reduce((acc, key) => acc?.[key], obj);
31
32
  };
32
- const values = keys.map((key) => resolvePath(key, el._context));
33
+ const values = keys.map((key) => resolvePath(key, context));
33
34
  if(!value)return
34
35
  value = value.replace(regex, (match, expression) => {
35
36
  if (checkKeywordsExistence(el._staticContext,expression)) {
@@ -71,7 +72,10 @@ export const resume_attribute=(el,attr,isName)=>{
71
72
  return
72
73
  }
73
74
  el.removeAttribute(attr.name)
74
- const attrName=attr.name.slice(5)
75
+ let attrName=attr.name.slice(5)
76
+ if (attrName.startsWith('c-at')) {
77
+ attrName=attrName.slice(5)
78
+ }
75
79
  const attrValue=attr.value
76
80
  el._preRenderAvoid.push(attrName)
77
81
  // A set of attributes that are treated as booleans and are best controlled via properties.
@@ -79,6 +83,7 @@ export const resume_attribute=(el,attr,isName)=>{
79
83
  el._mainAttribute[attrName]=attr.value
80
84
  el._checkStatic()
81
85
  el.removeAttribute(attr.name)
86
+ const context=el._context
82
87
  const evaluate = () => {
83
88
 
84
89
  try{
@@ -86,11 +91,11 @@ export const resume_attribute=(el,attr,isName)=>{
86
91
  let value = attrValue;
87
92
  let isBoolean
88
93
  const regex = /@{([^}]*)}/g;
89
- const keys = Object.keys(el._context);
94
+ const keys = Object.keys(context);
90
95
  const resolvePath = (path, obj) => {
91
96
  return path.split('.').reduce((acc, key) => acc?.[key], obj);
92
97
  };
93
- const values = keys.map((key) => resolvePath(key, el._context));
98
+ const values = keys.map((key) => resolvePath(key, context));
94
99
 
95
100
  value = value.replace(regex, (match, expression) => {
96
101
  if(checkKeywordsExistence(el._staticContext,expression)){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pawajs-continue",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Pawajs continuity initializer library for ssr",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,6 +23,6 @@
23
23
  },
24
24
  "homepage": "https://github.com/Allisboy/pawajs-continue#readme",
25
25
  "dependencies": {
26
- "pawajs": "^1.4.14"
26
+ "pawajs": "^1.4.24"
27
27
  }
28
28
  }