From 7c491a8ae3f29b6ffc686b61ccd0b112e2663d8a Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Thu, 12 Nov 2020 12:03:02 -0500 Subject: [PATCH] reload doc in session so schema changes are captured --- fiftyone/core/dataset.py | 2 -- fiftyone/core/session.py | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fiftyone/core/dataset.py b/fiftyone/core/dataset.py index bd02c8f1da..c9f2792c55 100644 --- a/fiftyone/core/dataset.py +++ b/fiftyone/core/dataset.py @@ -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): @@ -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): diff --git a/fiftyone/core/session.py b/fiftyone/core/session.py index e02beb51ec..99c128cfc1 100644 --- a/fiftyone/core/session.py +++ b/fiftyone/core/session.py @@ -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 = [] @@ -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 = []