mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-03-19 14:17:48 +02:00
[#5973] fixed Record.Fresh and Record.Clone method not properly copying the record fields
This commit is contained in:
parent
bcb2dca44e
commit
51ac522e7f
@ -589,8 +589,10 @@ func (m *Record) Original() *Record {
|
||||
func (m *Record) Fresh() *Record {
|
||||
newRecord := m.Original()
|
||||
|
||||
// note: this will also load the Id field though m.Get
|
||||
newRecord.Load(m.FieldsData())
|
||||
// note: this will also load the Id field through m.GetRaw
|
||||
for _, field := range m.collection.Fields {
|
||||
newRecord.SetRaw(field.GetName(), m.GetRaw(field.GetName()))
|
||||
}
|
||||
|
||||
return newRecord
|
||||
}
|
||||
@ -609,7 +611,10 @@ func (m *Record) Clone() *Record {
|
||||
newRecord.ignoreUnchangedFields = m.ignoreUnchangedFields
|
||||
newRecord.customVisibility.Reset(m.customVisibility.GetAll())
|
||||
|
||||
newRecord.Load(m.data.GetAll())
|
||||
data := m.data.GetAll()
|
||||
for k, v := range data {
|
||||
newRecord.SetRaw(k, v)
|
||||
}
|
||||
|
||||
if m.expand != nil {
|
||||
newRecord.SetExpand(m.expand.GetAll())
|
||||
|
Loading…
x
Reference in New Issue
Block a user