Skip to content

Commit

Permalink
reload doc in session so schema changes are captured
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpkane committed Nov 12, 2020
1 parent 58b601a commit 7c491a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions fiftyone/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ def add_sample(self, sample, expand_schema=True):
sample.frames._serve(self)
sample.frames._save(insert=True)

self._doc.reload()
return str(d["_id"])

def add_samples(self, samples, expand_schema=True, num_samples=None):
Expand Down Expand Up @@ -742,7 +741,6 @@ def add_samples(self, samples, expand_schema=True, num_samples=None):
)
pb.update(count=len(batch))

self._doc.reload()
return sample_ids

def _add_samples_batch(self, samples, expand_schema):
Expand Down
3 changes: 3 additions & 0 deletions fiftyone/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def dataset(self):
@dataset.setter
@_update_state
def dataset(self, dataset):
if dataset is not None:
dataset._doc.reload()
self.state.dataset = dataset
self.state.view = None
self.state.selected = []
Expand Down Expand Up @@ -235,6 +237,7 @@ def view(self, view):
self.state.view = view
if view is not None:
self.state.dataset = self.state.view._dataset
self.state.dataset._doc.reload()

self.state.selected = []
self.state.selected_objects = []
Expand Down

0 comments on commit 7c491a8

Please sign in to comment.