frappe-ui 0.0.63 → 0.0.66

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.0.63",
3
+ "version": "0.0.66",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -206,6 +206,7 @@ export default {
206
206
  'Align Right',
207
207
  'Separator',
208
208
  'Image',
209
+ 'Link',
209
210
  'Blockquote',
210
211
  'Code',
211
212
  'Horizontal Rule',
@@ -165,6 +165,14 @@ export function createDocumentResource(options, vm) {
165
165
  return doc
166
166
  }
167
167
 
168
+ if (options.realtime && vm.$socket) {
169
+ vm.$socket.on('list_update', (data) => {
170
+ if (data.doctype == out.doctype && data.name == out.name) {
171
+ out.get.fetch()
172
+ }
173
+ })
174
+ }
175
+
168
176
  // cache
169
177
  documentCache[cacheKey] = out
170
178
  // offline
@@ -70,7 +70,7 @@ export function createListResource(options, vm, getResource) {
70
70
  makeParams(name) {
71
71
  return {
72
72
  doctype: out.doctype,
73
- fields: out.fields,
73
+ fields: out.fields || '*',
74
74
  filters: { name },
75
75
  }
76
76
  },
@@ -193,6 +193,17 @@ export function createListResource(options, vm, getResource) {
193
193
  out.list.fetch()
194
194
  }
195
195
 
196
+ if (options.realtime && vm.$socket) {
197
+ vm.$socket.on('list_update', (data) => {
198
+ if (
199
+ data.doctype === out.doctype &&
200
+ out.originalData?.find((d) => d.name === data.name)
201
+ ) {
202
+ out.fetchOne.submit(data.name)
203
+ }
204
+ })
205
+ }
206
+
196
207
  if (cacheKey) {
197
208
  // cache
198
209
  listCache[cacheKey] = out
@@ -6,6 +6,6 @@ export default function initSocket(options = {}) {
6
6
  let port = window.location.port ? `:${socketio_port}` : ''
7
7
  let protocol = port ? 'http' : 'https'
8
8
  let url = `${protocol}://${host}${port}`
9
- let socket = io(url)
9
+ let socket = io(url, { withCredentials: true })
10
10
  return socket
11
11
  }