@stoker-platform/web-app 0.5.75 → 0.5.77

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.77
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: fix quill table initialisation
8
+
9
+ ## 0.5.76
10
+
11
+ ### Patch Changes
12
+
13
+ - feat!: simplify SDK API parameters
14
+ - Updated dependencies
15
+ - @stoker-platform/node-client@0.5.44
16
+ - @stoker-platform/web-client@0.5.44
17
+
3
18
  ## 0.5.75
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.75",
3
+ "version": "0.5.77",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.8",
53
53
  "@sentry/react": "^10.47.0",
54
- "@stoker-platform/node-client": "0.5.43",
54
+ "@stoker-platform/node-client": "0.5.44",
55
55
  "@stoker-platform/utils": "0.5.37",
56
- "@stoker-platform/web-client": "0.5.43",
56
+ "@stoker-platform/web-client": "0.5.44",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
package/src/Calendar.tsx CHANGED
@@ -498,7 +498,6 @@ export function Calendar({
498
498
  // TODO: subcollection support
499
499
  const result = await subscribeMany(
500
500
  [labels.collection],
501
- [...(constraints as QueryConstraint[]), where(calendarConfig.startField, "==", null)],
502
501
  (docs) => {
503
502
  docs.sort((a, b) => {
504
503
  // eslint-disable-next-line security/detect-object-injection
@@ -516,6 +515,10 @@ export function Calendar({
516
515
  console.error(error)
517
516
  },
518
517
  {
518
+ constraints: [
519
+ ...(constraints as QueryConstraint[]),
520
+ where(calendarConfig.startField, "==", null),
521
+ ],
519
522
  pagination: {
520
523
  number: 250,
521
524
  },
@@ -781,7 +784,7 @@ export function Calendar({
781
784
 
782
785
  const originalRecord = cloneDeep(record)
783
786
  setGlobalLoading("+", record.id, serverWrite, !(serverWrite || isServerReadOnly))
784
- updateRecord(record.Collection_Path, record.id, updatedFields, undefined, undefined, originalRecord)
787
+ updateRecord(record.Collection_Path, record.id, updatedFields, { originalRecord })
785
788
  .then(() => {
786
789
  if (serverWrite || isServerReadOnly) {
787
790
  toast({
package/src/Cards.tsx CHANGED
@@ -618,9 +618,7 @@ function DropZone({
618
618
  record.Collection_Path,
619
619
  record.id,
620
620
  { [statusField.name]: statusValue },
621
- undefined,
622
- undefined,
623
- originalRecord,
621
+ { originalRecord },
624
622
  )
625
623
  .then(() => {
626
624
  if (serverWrite || isServerReadOnly) {
@@ -655,9 +653,7 @@ function DropZone({
655
653
  {
656
654
  [statusField.name]: statusValue === statusValues[0],
657
655
  },
658
- undefined,
659
- undefined,
660
- originalRecord,
656
+ { originalRecord },
661
657
  )
662
658
  .then(() => {
663
659
  if (serverWrite || isServerReadOnly) {
@@ -611,12 +611,6 @@ function Collection({
611
611
  // TODO: subcollection support
612
612
  const result = await subscribeMany(
613
613
  [labels.collection],
614
- [
615
- ...(currentQuery.constraints as QueryConstraint[]),
616
- ...(additionalConstraintsRef.current?.map((constraint) =>
617
- where(constraint[0], constraint[1] as WhereFilterOp, constraint[2]),
618
- ) || []),
619
- ],
620
614
  (docs: StokerRecord[], cursor?: Cursor) => {
621
615
  loadedDocs = docs
622
616
  newCursor = {
@@ -640,6 +634,12 @@ function Collection({
640
634
  },
641
635
  {
642
636
  ...currentQuery.options,
637
+ constraints: [
638
+ ...(currentQuery.constraints as QueryConstraint[]),
639
+ ...(additionalConstraintsRef.current?.map((constraint) =>
640
+ where(constraint[0], constraint[1] as WhereFilterOp, constraint[2]),
641
+ ) || []),
642
+ ],
643
643
  tempCache:
644
644
  isPreloadCacheEnabled && relationList?.loadAll
645
645
  ? {
@@ -668,14 +668,13 @@ function Collection({
668
668
  const options = cloneDeep(query.queries[0].options)
669
669
  delete options.pagination
670
670
  // TODO: subcollection support
671
- const data = await getSome(
672
- [labels.collection],
673
- [
671
+ const data = await getSome([labels.collection], {
672
+ ...(options as GetSomeOptions),
673
+ constraints: [
674
674
  ...(query.queries[0].constraints as [string, WhereFilterOp, unknown][]),
675
675
  ...(additionalConstraintsRef.current || []),
676
676
  ],
677
- options as GetSomeOptions,
678
- )
677
+ })
679
678
  setServerList((prev) => ({ ...prev, [key]: data.docs }))
680
679
  setOptimisticList(data.docs, key)
681
680
  setIsRouteLoading("-", location.pathname)
@@ -1402,10 +1401,10 @@ function Collection({
1402
1401
  // TODO: subcollection support
1403
1402
  const serverData = await getSome(
1404
1403
  [labels.collection],
1405
- finalConstraints,
1406
1404
  isServerReadOnly
1407
- ? undefined
1405
+ ? { constraints: finalConstraints }
1408
1406
  : {
1407
+ constraints: finalConstraints,
1409
1408
  pagination: { orderByField, orderByDirection, number: 10000 },
1410
1409
  },
1411
1410
  )
@@ -1554,17 +1553,14 @@ function Collection({
1554
1553
  }
1555
1554
 
1556
1555
  // TODO: subcollection support
1557
- const data = await getSome(
1558
- [labels.collection],
1559
- (isServerReadOnly ? serverConstraints : webConstraints) as
1556
+ const data = await getSome([labels.collection], {
1557
+ constraints: (isServerReadOnly ? serverConstraints : webConstraints) as
1560
1558
  | [string, WhereFilterOp, unknown][]
1561
1559
  | QueryConstraint[],
1562
- {
1563
- only: isPreloadCacheEnabled ? "cache" : undefined,
1564
- pagination: isPreloadCacheEnabled ? undefined : { number: 10 },
1565
- noEmbeddingFields: true,
1566
- },
1567
- )
1560
+ only: isPreloadCacheEnabled ? "cache" : undefined,
1561
+ pagination: isPreloadCacheEnabled ? undefined : { number: 10 },
1562
+ noEmbeddingFields: true,
1563
+ })
1568
1564
 
1569
1565
  const parentId = relationParent?.id
1570
1566
  const relationArrayField = `${relationList.field}_Array`
@@ -1625,7 +1621,7 @@ function Collection({
1625
1621
  isRelationServerWrite,
1626
1622
  !(isRelationServerWrite || isRelationServerReadOnly),
1627
1623
  )
1628
- updateRecord(record.Collection_Path, record.id, updatedFields, undefined, undefined, originalRecord)
1624
+ updateRecord(record.Collection_Path, record.id, updatedFields, { originalRecord })
1629
1625
  .then(() => {
1630
1626
  if (isRelationServerWrite || isRelationServerReadOnly) {
1631
1627
  if (isRelationServerReadOnly) {
package/src/Filters.tsx CHANGED
@@ -292,7 +292,8 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
292
292
  }
293
293
 
294
294
  // TODO: subcollection support
295
- getSome([collection], newConstraints as QueryConstraint[] | [string, WhereFilterOp, unknown][], {
295
+ getSome([collection], {
296
+ constraints: newConstraints as QueryConstraint[] | [string, WhereFilterOp, unknown][],
296
297
  only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
297
298
  pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
298
299
  noEmbeddingFields: true,
package/src/Form.tsx CHANGED
@@ -1650,11 +1650,14 @@ const RichTextEditor = forwardRef<
1650
1650
  }
1651
1651
 
1652
1652
  if (formField.value) {
1653
- quill.updateContents(formField.value)
1653
+ quill.updateContents(formField.value, Quill.sources.SILENT)
1654
+ formField.onChange(quill.getContents())
1654
1655
  }
1655
1656
 
1656
- quill.on(Quill.events.TEXT_CHANGE, () => {
1657
- formField.onChange(quill.getContents())
1657
+ quill.on(Quill.events.TEXT_CHANGE, (_delta: Delta, _oldContents: Delta, source: string) => {
1658
+ if (source !== Quill.sources.SILENT) {
1659
+ formField.onChange(quill.getContents())
1660
+ }
1658
1661
  })
1659
1662
 
1660
1663
  return () => {
@@ -1921,7 +1924,8 @@ function RelationField({
1921
1924
  }
1922
1925
 
1923
1926
  // TODO: subcollection support
1924
- getSome([labels.collection], newConstraints, {
1927
+ getSome([labels.collection], {
1928
+ constraints: newConstraints,
1925
1929
  only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
1926
1930
  pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
1927
1931
  noEmbeddingFields: true,
@@ -3978,14 +3982,11 @@ function RecordForm({
3978
3982
  }
3979
3983
  }
3980
3984
 
3981
- addRecord(
3982
- path,
3983
- recordToSave,
3984
- userData as UserData & { password: string; passwordConfirm: string },
3985
- undefined,
3986
- docId,
3985
+ addRecord(path, recordToSave, {
3986
+ user: userData as UserData & { password: string; passwordConfirm: string },
3987
+ id: docId,
3987
3988
  onValid,
3988
- )
3989
+ })
3989
3990
  .then((record: Partial<StokerRecord>) => {
3990
3991
  if (serverWrite || isServerReadOnly) {
3991
3992
  toast({
@@ -4027,7 +4028,7 @@ function RecordForm({
4027
4028
  const filePath = `${basePath}/${filename}`
4028
4029
  const storageRef = ref(storage, filePath)
4029
4030
  const url = await getDownloadURL(storageRef)
4030
- await updateRecord(path, docId, { [fieldName]: url }, undefined, undefined, originalRecord)
4031
+ await updateRecord(path, docId, { [fieldName]: url }, { originalRecord })
4031
4032
  }
4032
4033
  setQueuedImageUploads({})
4033
4034
  })
@@ -4086,14 +4087,10 @@ function RecordForm({
4086
4087
 
4087
4088
  const finalRecord = { ...originalRecord, ...cloneDeep(recordToSave) } as StokerRecord
4088
4089
 
4089
- updateRecord(
4090
- path,
4091
- id,
4092
- recordToSave,
4093
- userData as UserData & { operation: "create" | "update" | "delete" },
4094
- undefined,
4090
+ updateRecord(path, id, recordToSave, {
4091
+ user: userData as UserData & { operation: "create" | "update" | "delete" },
4095
4092
  originalRecord,
4096
- )
4093
+ })
4097
4094
  .then(async () => {
4098
4095
  if (serverWrite || isServerReadOnly) {
4099
4096
  toast({
@@ -4152,14 +4149,9 @@ function RecordForm({
4152
4149
  const serverWrite = isServerUpdate(collection, { ...recordToSave, id: selectedRecord.id })
4153
4150
  setGlobalLoading("+", selectedRecord.id, serverWrite, !(serverWrite || isServerReadOnly))
4154
4151
 
4155
- const updatePromise = updateRecord(
4156
- path,
4157
- selectedRecord.id,
4158
- recordToSave,
4159
- undefined,
4160
- undefined,
4161
- selectedRecord,
4162
- )
4152
+ const updatePromise = updateRecord(path, selectedRecord.id, recordToSave, {
4153
+ originalRecord: selectedRecord,
4154
+ })
4163
4155
  .catch((error) => {
4164
4156
  console.error(`Failed to update record ${selectedRecord.id}:`, error)
4165
4157
  toast({
package/src/Map.tsx CHANGED
@@ -480,7 +480,7 @@ export function Map({
480
480
 
481
481
  setGlobalLoading("+", record.id, serverWrite, !(serverWrite || isServerReadOnly))
482
482
  isUpdatingRecord.current = false
483
- updateRecord(record.Collection_Path, record.id, updatedFields, undefined, undefined, originalRecord)
483
+ updateRecord(record.Collection_Path, record.id, updatedFields, { originalRecord })
484
484
  .then(() => {
485
485
  if (serverWrite || isServerReadOnly) {
486
486
  toast({
@@ -124,7 +124,8 @@ export const PermissionPicker = ({
124
124
  }
125
125
 
126
126
  // TODO: subcollection support
127
- getSome([labels.collection], newConstraints, {
127
+ getSome([labels.collection], {
128
+ constraints: newConstraints,
128
129
  only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
129
130
  pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
130
131
  noEmbeddingFields: true,
@@ -110,7 +110,6 @@ export function SearchAllResults({ collection, search }: { collection: Collectio
110
110
 
111
111
  const result = await subscribeMany(
112
112
  [labels.collection],
113
- currentQuery.constraints as QueryConstraint[],
114
113
  (docs: StokerRecord[]) => {
115
114
  loadedDocs = docs
116
115
  queryLoaded = true
@@ -126,6 +125,7 @@ export function SearchAllResults({ collection, search }: { collection: Collectio
126
125
  resolve()
127
126
  },
128
127
  {
128
+ constraints: currentQuery.constraints as QueryConstraint[],
129
129
  pagination: {
130
130
  number: 5,
131
131
  },
@@ -145,15 +145,12 @@ export function SearchAllResults({ collection, search }: { collection: Collectio
145
145
  }
146
146
 
147
147
  const getServerData = async () => {
148
- const data = await getSome(
149
- [labels.collection],
150
- query.queries[0].constraints as [string, WhereFilterOp, unknown][],
151
- {
152
- pagination: {
153
- number: 5,
154
- },
148
+ const data = await getSome([labels.collection], {
149
+ constraints: query.queries[0].constraints as [string, WhereFilterOp, unknown][],
150
+ pagination: {
151
+ number: 5,
155
152
  },
156
- )
153
+ })
157
154
  setResults(data.docs)
158
155
  setLoading(false)
159
156
  resolve()
@@ -51,7 +51,6 @@ export const getData = async (
51
51
  // TODO: subcollection support
52
52
  const result = await subscribeMany(
53
53
  [labels.collection],
54
- currentQuery.constraints as QueryConstraint[],
55
54
  (docs: StokerRecord[]) => {
56
55
  loadedDocs = docs
57
56
  queryLoaded = true
@@ -66,6 +65,7 @@ export const getData = async (
66
65
  }
67
66
  resolve()
68
67
  },
68
+ { constraints: currentQuery.constraints as QueryConstraint[] },
69
69
  )
70
70
  const { unsubscribe: newUnsubscribe } = result
71
71
  promiseLoaded = true
@@ -82,10 +82,9 @@ export const getData = async (
82
82
 
83
83
  const getServerData = async () => {
84
84
  // TODO: subcollection support
85
- const data = await getSome(
86
- [labels.collection],
87
- query.queries[0].constraints as [string, WhereFilterOp, unknown][],
88
- )
85
+ const data = await getSome([labels.collection], {
86
+ constraints: query.queries[0].constraints as [string, WhereFilterOp, unknown][],
87
+ })
89
88
  setResults(data.docs)
90
89
  setLoading(false)
91
90
  resolve()